RoaringBitmap / croaring-rs

Rust FFI wrapper for CRoaring
Apache License 2.0
156 stars 43 forks source link

Add std feature flag #131

Closed lucascool12 closed 2 months ago

lucascool12 commented 4 months ago

Currently the croaring crate depends on the rust standard library even though it doesn't use any particular features that are only available in the std library (as far as I've seen). Adding a std feature flag would allow this crate to be used in environments that are unable/unwilling to depend on the rust standard library, such as embedded environments.

Dr-Emann commented 4 months ago

At least the TreeMap type is backed by a BTreeMap, and things like serialize/serialize_into use Vec.

But it does seem like it wouldn't be too difficult to only require alloc, and provide a fully no-std build too.

Dr-Emann commented 4 months ago

Ah, one thing is our use of std::panic::catch_unwind, which isn't available outside of std, and there's not really a path currently to getting it in core/alloc AFAICS. I don't think there's a safe way to pass an arbitrary callback to C without it, but we could provide a std feature by default, and an alloc feature, and a completely no-std version without either.

Dr-Emann commented 2 months ago

Released as croaring 2.0: