10 releases
0.3.0 | Aug 29, 2024 |
---|---|
0.2.0 | Aug 13, 2024 |
0.1.7 | Jan 22, 2024 |
0.1.4 | Dec 20, 2023 |
0.1.0 | Jul 3, 2023 |
#463 in Data structures
98 downloads per month
Used in 15 crates
(5 directly)
75KB
2K
SLoC
ds-ext
Extensions to standard Rust data structures which provide additional capabilities
Example usage:
use ds_ext::*;
let mut set = OrdHashSet::new();
set.insert(1);
assert!(set.contains(&1));
let mut map = OrdHashMap::from_iter(set.into_iter().map(|i| (i, i)));
assert_eq!(map.get(&1), map.bisect(|i| i.partial_cmp(&1)));
//! ```
lib.rs
:
This crate repackages standard data structures with additional capabilities, like fast ordered maps and sets.
OrdHashSet
uses a [Vec
] internally for ordering.
OrdHashSet
and OrdHashMap
both implement a bisect
method
which allows looking up a key by comparison,
potentially avoiding the need for a heap allocation to construct a search key..
Features:
all
: enables all featuresserialize
: enables support forserde
.stream
: enables support fordestream
.hash
: enables support forasync-hash
.
Example usage:
use ds_ext::*;
let mut set = OrdHashSet::new();
assert!(set.is_empty());
set.insert(1);
assert!(set.contains(&1));
assert_eq!(set.len(), 1);
let mut map = OrdHashMap::from_iter(set.into_iter().map(|i| (i, i)));
assert_eq!(map.len(), 1);
assert_eq!(map.get(&1), map.bisect(|i| i.partial_cmp(&1)));
Dependencies
~0.8–1.8MB
~35K SLoC