16 releases

new 0.3.9 Apr 18, 2019
0.3.8 Jan 14, 2019
0.3.7 Nov 8, 2018
0.3.5 Jul 3, 2018
0.1.3 Oct 9, 2016

#2 in #bitmap

Download history 448/week @ 2018-12-20 548/week @ 2018-12-27 1037/week @ 2019-01-03 2829/week @ 2019-01-10 2513/week @ 2019-01-17 1661/week @ 2019-01-24 901/week @ 2019-01-31 834/week @ 2019-02-07 656/week @ 2019-02-14 507/week @ 2019-02-21 433/week @ 2019-02-28 333/week @ 2019-03-07 294/week @ 2019-03-14 254/week @ 2019-03-21 252/week @ 2019-03-28

2,808 downloads per month
Used in 16 crates (3 directly)

Apache-2.0

533KB
10K SLoC

C 10K SLoC // 0.1% comments Rust 494 SLoC // 0.7% comments

croaring-rs https://travis-ci.org/saulius/croaring-rs

A Rust wrapper for CRoaring (a C/C++ implementation at https://github.com/RoaringBitmap/CRoaring)

The original java version can be found at https://github.com/RoaringBitmap/RoaringBitmap

Usage example

use croaring::Bitmap;

let mut rb1 = Bitmap::create();
rb1.add(1);
rb1.add(2);
rb1.add(3);
rb1.add(4);
rb1.add(5);
rb1.add(100);
rb1.add(1000);
rb1.run_optimize();

let mut rb2 = Bitmap::create();
rb2.add(3);
rb2.add(4);
rb2.add(1000);
rb2.run_optimize();

let mut rb3 = Bitmap::create();

assert_eq!(rb1.cardinality(), 7);
assert!(rb1.contains(3));

rb1.and_inplace(&rb2);
rb3.add(5);
rb3.or_inplace(&rb1);

let mut rb4 = Bitmap::fast_or(&[&rb1, &rb2, &rb3]);

rb1.and_inplace(&rb2);
println!("{:?}", rb1);

rb3.add(5);
rb3.or_inplace(&rb1);

println!("{:?}", rb1);

rb3.add(5);
rb3.or_inplace(&rb1);

println!("{:?}", rb3.to_vec());
println!("{:?}", rb3);
println!("{:?}", rb4);

rb4 = Bitmap::fast_or(&[&rb1, &rb2, &rb3]);

println!("{:?}", rb4);

Building locally

git clone --recursive https://github.com/saulius/croaring-rs/
cd croaring-rs
cargo build

Tested on Rust stable/beta/nightly and LLVM version 3.8.

Testing

Running unit tests and doc tests:

cargo test

Running benchmark suite (currently on Rust nightly toolchain only):

cargo bench

Documentation

Current documentation is available at https://saulius.github.io/croaring-rs/croaring/

Dependencies

~1.5MB
~34K SLoC