Repository navigation
⚠️ Breaking Changes
extract_if takes a range on OrderedSkipList and SkipMap
OrderedSkipList::extract_if and SkipMap::extract_if now take a range as their first argument, matching SkipSet::extract_if. The predicate sees only elements (or keys) inside the range, and iteration stops at the upper bound.
Calls written as extract_if(pred) no longer compile. Pass .. to keep the 1.x behaviour of visiting every element:
// 1.x
let evens: Vec<_> = list.extract_if(|x| *x % 2 == 0).collect();
// 2.0
let evens: Vec<_> = list.extract_if(.., |x| *x % 2 == 0).collect();A narrower range skips the elements outside it without calling the predicate on them. Code that names the ExtractIf iterator type must add the range type R, which sits between G and F.
std is now a default feature
The crate is now no_std and requires alloc. The new std feature is on by default and seeds level generators from rand::rng(). Projects that use the default features see no change.
Projects that set default-features = false lose every constructor that seeds a Geometric from entropy:
Geometric::newandimpl Default for Geometricnew,with_capacityandwith_comparatoron the collectionsDefault,FromIteratorandFrom<Vec<T>>/From<[T; M]>for the default generator- The
SkipSetoperators|,&,-and^
Pick one of the following to migrate:
- Add
features = ["std"]to restore the 1.x behaviour. - Add
features = ["getrandom"]to seed from the operating system withoutstd. In this configurationGeometric::newreturnsGeometricError::Entropywhen the operating system source fails, andnew()andDefaultpanic. Onwasm32-unknown-unknown, also enable thewasm_jsfeature ofgetrandomin your ownCargo.toml. - Seed explicitly with
Geometric::new_with_seedand pass the generator towith_level_generatororwith_comparator_and_level_generator.SkipList::with_capacity_and_seedreplacesSkipList::with_capacity.
The no_std guide lists the replacement for each constructor.
Geometric caps total at 64
Geometric::new and Geometric::new_with_seed reject a total above Geometric::MAX_TOTAL (64) with GeometricError::MaxTooLarge. In 1.x the limit was i32::MAX. At q = 0.5, 64 levels already serve about 2^64 elements, so lowering a larger total to 64 loses nothing. SkipList::with_capacity clamps its derived level count to 64 and never hits this error.
The Display text of MaxTooLarge now reads max must be at most 64.
🚀 Features
-
(skip_list) Add with_capacity_and_seed
-
[breaking] Support no_std with alloc
-
(geometric) [breaking] Sample from a CDF table
-
(ordered_skip_list) [breaking] Take a range in extract_if
-
(skip_map) [breaking] Take a range in extract_if
🐛 Bug Fixes
-
(skip_list) Document and restore ctor links
-
(geometric) Validate before seeding
🚜 Refactor
-
Prefer core and alloc over std
-
(geometric) Store CDF in Sampler::Table
📚 Documentation
-
Link gated items to the features section
-
Restore gated constructor links
-
Correct std feature and level clamp
-
Document no_std support
🧪 Testing
- Exercise constructors without entropy
⚙️ Miscellaneous Tasks
-
(ci) Check doc links in every feature set
-
(ci) Group additive features in powerset
-
(ci) Lint every library feature set
-
(ci) Run doc-page examples
-
(ci) Build no_std with all features
-
(ci) Build for no_std targets