#order #ordered #set #map #extension #custom

ds-ext

Extensions to standard Rust data structures which provide additional capabilities

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

Download history 214/week @ 2024-08-11 42/week @ 2024-08-18 217/week @ 2024-08-25 53/week @ 2024-09-01 26/week @ 2024-09-08 63/week @ 2024-09-15 49/week @ 2024-09-22 52/week @ 2024-09-29 8/week @ 2024-10-06 23/week @ 2024-10-13 16/week @ 2024-10-20 19/week @ 2024-10-27 41/week @ 2024-11-03 2/week @ 2024-11-10 15/week @ 2024-11-17 39/week @ 2024-11-24

98 downloads per month
Used in 15 crates (5 directly)

Apache-2.0

75KB
2K SLoC

ds-ext

Crates.io Docs.rs

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 features
  • serialize: enables support for serde.
  • stream: enables support for destream.
  • hash: enables support for async-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