ranged_set

Crates.ioranged_set
lib.rsranged_set
version0.4.1
sourcesrc
created_at2017-02-10 17:33:12.849185
updated_at2017-04-25 23:29:18.886653
descriptionA set that stores contiguous values as a range. Designed to be used with numeric types.
homepage
repositoryhttps://github.com/ryanq/ranged_set
max_upload_size
id8457
size32,906
Ryan Quattlebaum (ryanq)

documentation

https://docs.rs/ranged_set/0.2.0/ranged_set/

README

ranged_set

Build Status Build status Crate on crates.io

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:

[dependencies]
ranged_set = "0.4.0"

or, if you want the bleeding edge version:

[dependencies]
ranged_set = { git = "https://github.com/ryanq/ranged_set" }

Then import the crate and type in your source:

extern crate ranged_set;

use ranged_set::RangedSet;

Then you can use the type for efficiently storing numbers (w.r.t. space, at least):

let set = RangedSet::new();
set.insert(0);
set.insert(1);
set.insert(2);
set.insert(3);
set.insert(4);
// ...

assert!(set.contains(&0));
Commit count: 60

cargo fmt