15 releases

0.3.8 Jan 14, 2019
0.3.7 Nov 8, 2018
0.3.6 Aug 4, 2018
0.3.5 Jul 3, 2018
0.1.3 Oct 9, 2016

#6 in Images

Download history 220/week @ 2018-10-06 430/week @ 2018-10-13 178/week @ 2018-10-20 162/week @ 2018-10-27 266/week @ 2018-11-03 276/week @ 2018-11-10 149/week @ 2018-11-17 296/week @ 2018-11-24 302/week @ 2018-12-01 241/week @ 2018-12-08 294/week @ 2018-12-15 489/week @ 2018-12-22 666/week @ 2018-12-29 1132/week @ 2019-01-05 3485/week @ 2019-01-12

2,745 downloads per month
Used in 10 crates (3 directly)

Apache-2.0

522KB
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