mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
Move stdlib into its own crate
This commit is contained in:
parent
4502d2630f
commit
c7a923d226
11 changed files with 334 additions and 81 deletions
15
stdlib/src/map.rs
Normal file
15
stdlib/src/map.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
use im_rc::hashmap::HashMap;
|
||||
use im_rc::vector::Vector;
|
||||
use fxhash::FxHasher;
|
||||
|
||||
/// A persistent HashMap which records insertion order and iterates in that order.
|
||||
pub struct Map<K, V> {
|
||||
store: HashMap<K, V, BuildHasherDefault<FxHasher>>;
|
||||
order: Vector<K>
|
||||
}
|
||||
|
||||
impl<K, V> Map<K, V> {
|
||||
pub fn is_empty(self) -> bool {
|
||||
self.store.is_empty()
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue