Compatibility: crate-level items
Spec: docs/spec/00-overview.md §2–§4, docs/spec/macros-and-iter.md. Legend and 01:
labels: ../COMPAT.md. Rows here cover macros, modules, iter::unfold,
shared_ptr and the Generic* structs; proptest strategies, Cargo features and the pool types are
in features.md.
Macros (exported at the root, also documented under their modules)
| item | im 15.1 | imbl 7 | perennial | status | test |
|---|---|---|---|---|---|
vector![] |
arms: empty, list, list with trailing comma | as im (builds the alias type) | as im | same | tests/compat_crate.rs::vector_macro |
hashmap!{k => v, ...} |
trailing comma allowed; later duplicate keys overwrite; default hasher | as im | as im | same | tests/compat_crate.rs::hashmap_macro |
hashset![] |
trailing comma allowed | as im | as im | same | tests/compat_crate.rs::hashset_macro |
ordmap!{k => v, ...} |
no trailing-comma arm in docs; empty form needs a type annotation | as im | as im | same | tests/compat_crate.rs::ordmap_macro |
ordset![] |
no trailing-comma arm in docs | as im | as im | same | tests/compat_crate.rs::ordset_macro |
get_in![target, k1 => k2 => ...] |
Option<&T> over nested Vector/OrdMap/HashMap; None on any missing step; map steps are &key, vector steps usize |
as im | as im | same | tests/compat_crate.rs::get_in_macro |
update_in![target, k1 => ... , value] |
persistent update per level; final map step inserts a missing key (docs say panic); a missing intermediate step panics update_in! macro: key not found in target (observed black-box in im-rc; the spec's index_mut text holds only for the final vector index); recursive arms call the macro by its bare name, so a multi-step im_rc::update_in!/get_in! needs the macro imported |
as im | as im (observed behaviour, not the docs sentence); multi-step calls also work through the full path | same | tests/compat_crate.rs::update_in_macro |
Modules and root re-exports
| item | im 15.1 | imbl 7 | perennial | status | test |
|---|---|---|---|---|---|
root re-exports HashMap, HashSet, OrdMap, OrdSet, Vector |
structs | aliases | aliases (01:generic) | same | tests/compat_crate.rs::root_reexports |
hashmap module (HashMap, Entry, OccupiedEntry, VacantEntry, Iter, IterMut, Keys, Values, ConsumingIter, HashMapPool) |
yes; pool type im-rc only | no pool type | as im; pool type behind feature pool |
same | tests/compat_crate.rs::hashmap_module |
hashset module (HashSet, Iter, ConsumingIter, HashSetPool) |
yes | no pool type | as im | same | tests/compat_crate.rs::hashset_module |
ordmap module (OrdMap, Entry, OccupiedEntry, VacantEntry, Iter, Keys, Values, ConsumingIter, DiffIter, DiffItem, RangedIter, NodeDiffIter, NodeDiffItem, OrdMapPool) |
yes | no pool, no node-diff re-exports | as im, except RangedIter is an alias of Iter (01:range-type) and the node-diff re-exports are absent (01:no-node-diff) |
same | tests/compat_crate.rs::ordmap_module |
ordset module (OrdSet, Iter, RangedIter, ConsumingIter, DiffIter, DiffItem, OrdSetPool) |
yes | no pool type | as im | same | tests/compat_crate.rs::ordset_module |
vector module (Vector, Iter, IterMut, ConsumingIter, Chunks, ChunksMut, Focus, FocusMut, RRBPool) |
yes | no pool type | as im | same | tests/compat_crate.rs::vector_module |
vector::rayon module (feature rayon) |
im only | yes | perennial only; Rc is not Send (01:features) |
same | tests/compat_crate_features.rs::vector_rayon_module |
iter module |
unfold |
as im | as im | same | tests/compat_crate.rs::iter_module |
proptest module (feature proptest) |
five strategy functions | as im | as im | same | tests/compat_crate_features.rs::proptest_module |
shared_ptr module |
absent | re-exports archery's pointer-kind items | perennial's own trait and markers | same (imbl) | tests/compat_crate_generic.rs::shared_ptr_module |
iter::unfold
| item | im 15.1 | imbl 7 | perennial | status | test |
|---|---|---|---|---|---|
unfold<F, S, A>(value: S, f: F) -> impl Iterator<Item = A> (F: Fn(S) -> Option<(A, S)>) |
yields until f returns None; Fn, not FnMut |
as im | as im | same | tests/compat_crate.rs::unfold |
shared_ptr items and Generic* structs
| item | im 15.1 | imbl 7 | perennial | status | test |
|---|---|---|---|---|---|
shared_ptr::SharedPointerKind (trait) |
absent | archery's trait | perennial's own trait, implemented by RcK and ArcK |
same (imbl) | tests/compat_crate_generic.rs::shared_pointer_kind |
shared_ptr::RcK |
absent | marker | marker | same (imbl) | tests/compat_crate_generic.rs::rc_k |
shared_ptr::ArcK |
absent | marker | marker | same (imbl) | tests/compat_crate_generic.rs::arc_k |
shared_ptr::ArcTK (triomphe) |
absent | marker, feature triomphe |
not provided | not provided: imbl-only, not in im's API; not in 0.1 (01:imbl-only) | — |
shared_ptr::SharedPointer (struct) |
absent | archery re-export | not provided | not provided: imbl-only, not in im's API; not in 0.1 (01:imbl-only) | — |
shared_ptr::DefaultSharedPtr |
absent | ArcK (ArcTK with triomphe) |
ArcK in perennial, RcK in perennial-rc |
same (imbl) | tests/compat_crate_generic.rs::default_shared_ptr |
GenericVector<A, P> |
absent | yes | yes | same (imbl) | tests/compat_crate_generic.rs::generic_vector |
GenericHashMap<K, V, S, P> |
absent | yes | yes | same (imbl) | tests/compat_crate_generic.rs::generic_hash_map |
GenericHashSet<A, S, P> |
absent | yes | yes | same (imbl) | tests/compat_crate_generic.rs::generic_hash_set |
GenericOrdMap<K, V, P> |
absent | yes | yes | same (imbl) | tests/compat_crate_generic.rs::generic_ord_map |
GenericOrdSet<A, P> |
absent | yes | yes | same (imbl) | tests/compat_crate_generic.rs::generic_ord_set |
| variance of the collections' type parameters | covariant (e.g. Vector<&'static str> coerces to Vector<&'a str>) |
covariant | invariant: the node pointer is the generic associated type P::Pointer<T>, which the compiler treats as invariant |
differs: no subtyping coercion of a collection's element, key or value lifetimes (01:invariance) | doctest src/lib.rs (Variance, compile_fail) |