ranged_set
ranged_set
is a crate that provides the type RangedSet<T>
, which
acts as a set for numeric types and stores contiguous values in ranges
instead of in a hash table.
Documentation can be found on docs.rs.
Using ranged_set
Add the crate to the dependencies section of Cargo.toml:
[]
= "0.4.0"
or, if you want the bleeding edge version:
[]
= { = "https://github.com/ryanq/ranged_set" }
Then import the crate and type in your source:
extern crate ranged_set;
use RangedSet;
Then you can use the type for efficiently storing numbers (w.r.t. space, at least):
let set = new;
set.insert;
set.insert;
set.insert;
set.insert;
set.insert;
// ...
assert!;