croaring

Rust wrapper for CRoaring, providing fast compressed roaring bitmaps for set operations.

Library
Cargo
v2.7.0
172stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
70/100Good
Development Activity68
Maintenance60
Community72
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
84/100Excellent
Architecture86
Code Quality88
Innovation84
Learning Curve76

Croaring is a Rust wrapper around CRoaring, the high-performance C/C++ implementation of Roaring bitmaps. Roaring bitmaps are compressed bitmaps that store large sets of integers compactly while keeping set operations like union, intersection, and difference extremely fast, and this crate exposes that power through a safe, idiomatic Rust API.

It provides Bitmap, 64-bit bitmaps, bitsets, and a treemap type, with support for run-optimization, fast bulk operations, serialization, and cardinality queries. The library binds to the battle-tested CRoaring core used across databases and analytics systems.

What You Get

  • A Bitmap type for compressed 32-bit integer sets with fast set operations
  • 64-bit bitmap and treemap types for larger key spaces
  • In-place and bulk operations like and_inplace, or_inplace, and fast_or
  • Run-length optimization via run_optimize for dense ranges
  • Serialization and deserialization to portable binary formats
  • no_std/no_alloc capable feature gating with optional allocator integration

Common Use Cases

  • Storing and intersecting large sets of document or row IDs in search and analytics engines
  • Computing fast unions and intersections over integer sets
  • Persisting compressed bitmaps to disk or across a network
  • Reducing memory footprint for sparse or clustered integer sets

Under The Hood

Architecture - The workspace splits the safe Rust API (croaring) from the generated FFI bindings and vendored C core (croaring-sys). Within the croaring crate, types are organized by structure (bitmap, bitmap64, bitset, treemap) with cross-cutting serialization.rs, callback.rs, and rust_alloc modules, all re-exported through lib.rs. Tech Stack - Rust edition 2024 (MSRV 1.95) over the CRoaring C/C++ implementation, with optional allocator-api2 integration and feature gates for std, alloc, and no-alloc builds. Code Quality - The crate ships dedicated tests, benches, property-test regressions, and a fuzz target, reflecting strong correctness and performance discipline for an FFI wrapper. API Design - Method names mirror Roaring’s well-known operation set (add, contains, cardinality, and_inplace, fast_or) so users familiar with Roaring in other languages transfer knowledge directly, and the safe wrapper hides raw pointer management.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search