mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 05:06:44 +01:00
added Map based on FnvHashMap, and AutoPermMap, generalized gal_el
This commit is contained in:
7
utils/Cargo.toml
Normal file
7
utils/Cargo.toml
Normal file
@@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "utils"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
fnv = "1.0.7"
|
||||
1
utils/src/lib.rs
Normal file
1
utils/src/lib.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub mod map;
|
||||
20
utils/src/map.rs
Normal file
20
utils/src/map.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use fnv::FnvHashMap;
|
||||
use std::hash::Hash;
|
||||
|
||||
pub struct Map<K, V>(pub FnvHashMap<K, V>);
|
||||
|
||||
impl<K: Eq + Hash, V> Map<K, V> {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
0: FnvHashMap::<K, V>::default(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn insert(&mut self, k: K, data: V) -> Option<V> {
|
||||
self.0.insert(k, data)
|
||||
}
|
||||
|
||||
pub fn get(&self, k: &K) -> Option<&V> {
|
||||
self.0.get(k)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user