Compatibility: OrdSet

perennial@0.1.0Updated 5 min readView as markdown

Spec: docs/spec/ordset.md, docs/spec/set-algebra.md, docs/spec/ordering-and-equality.md. Legend and 01: labels: ../COMPAT.md. GenericOrdSet rows are in crate.md, OrdSetPool rows in features.md. HashSet: From<OrdSet> rows are in hashset.md.

Type and basics (impl<A> OrdSet<A>, no bounds)

item im 15.1 imbl 7 perennial status test
OrdSet<A> (type) struct alias of GenericOrdSet<A, DefaultSharedPtr> alias of GenericOrdSet<A, P> (01:generic) same tests/compat_ordset.rs::ord_set_type
new() -> Self as im as im same tests/compat_ordset.rs::new
with_pool(pool: &OrdSetPool<A>) -> Self im-rc pool absent size-only handle differs: pool does not pool allocations (01:pools) tests/compat_ordset_features.rs::with_pool
unit(a: A) -> Self as im as im same tests/compat_ordset.rs::unit
is_empty(&self) -> bool O(1) as im as im same tests/compat_ordset.rs::is_empty
len(&self) -> usize O(1) as im as im same tests/compat_ordset.rs::len
ptr_eq(&self, other: &Self) -> bool two empty → false two empty → true two empty → true differs: empty sets are ptr_eq (01:ptr_eq-empty) tests/compat_ordset.rs::ptr_eq
pool(&self) -> &OrdSetPool<A> im-rc pool absent size-only handle differs: handle only (01:pools) tests/compat_ordset_features.rs::pool
clear(&mut self) O(n) as im as im same tests/compat_ordset.rs::clear

Queries (A: Ord)

item im 15.1 imbl 7 perennial status test
get_min(&self) -> Option<&A> as im as im same tests/compat_ordset.rs::get_min
get_max(&self) -> Option<&A> as im as im same tests/compat_ordset.rs::get_max
iter(&self) -> Iter<'_, A> ascending as im as im same tests/compat_ordset.rs::iter
range<R, BA>(&self, r: R) -> RangedIter<'_, A> double-ended, no ExactSize; inverted/empty ranges yield nothing as im returns ordset::Iter with exact len(); inverted/empty ranges yield nothing differs: exact-size iterator of im's Iter shape (01:range-type) tests/compat_ordset.rs::range
diff<'a>(&'a self, other: &'a Self) -> DiffIter<'_, A> ascending; Update for Ord-equal, PartialEq-unequal elements two lifetimes; compares with Ord only (no Update there) as im: Update follows PartialEq, like == (01:ordset-eq) same tests/differential/ordset.rs
contains<BA>(&self, a: &BA) -> bool Comparable bounds as im (01:bounds) same tests/compat_ordset.rs::contains
get<Q>(&self, v: &Q) -> Option<&A> absent present (≥ 2.0.3) provided (01 "imbl additions kept") added (imbl API) tests/compat_ordset.rs::get
get_prev(&self, k: &A) -> Option<&A> greatest ≤ k; takes &A generic get_prev<Q>(&self, v: &Q) (≥ 3.0) imbl's generic borrowed-key form; every im call still compiles (01:loose-bounds) same tests/compat_ordset.rs::get_prev
get_next(&self, k: &A) -> Option<&A> least ≥ k; takes &A generic (≥ 3.0) imbl's generic borrowed-key form (01:loose-bounds) same tests/compat_ordset.rs::get_next
is_subset<RS>(&self, other: RS) -> bool O(n log m) as im as im same tests/compat_ordset.rs::is_subset
is_proper_subset<RS>(&self, other: RS) -> bool strictly smaller as im as im same tests/compat_ordset.rs::is_proper_subset

Mutation, persistent operations, set algebra, splitting (A: Ord + Clone)

item im 15.1 imbl 7 perennial status test
insert(&mut self, a: A) -> Option<A> returns old equal element, stores the new one as im as im same tests/compat_ordset.rs::insert
remove<BA>(&mut self, a: &BA) -> Option<A> as im as im same tests/compat_ordset.rs::remove
remove_min(&mut self) -> Option<A> None when empty as im as im same tests/compat_ordset.rs::remove_min
remove_max(&mut self) -> Option<A> None when empty as im as im same tests/compat_ordset.rs::remove_max
update(&self, a: A) -> Self persistent insert as im as im same tests/compat_ordset.rs::update
without<BA>(&self, a: &BA) -> Self persistent remove as im as im same tests/compat_ordset.rs::without
without_min(&self) -> (Option<A>, Self) as im as im same tests/compat_ordset.rs::without_min
without_max(&self) -> (Option<A>, Self) as im as im same tests/compat_ordset.rs::without_max
union(self, other: Self) -> Self element of the smaller operand stored; other's on a tie as im as im (01 decides only map value priority) same tests/compat_ordset.rs::union
unions(i: impl IntoIterator<Item = Self>) -> Self as im as im same tests/compat_ordset.rs::unions
difference(self, other: Self) -> Self symmetric difference (alias) deprecated deprecated, same meaning differs: deprecation warning only (01:difference) tests/compat_ordset.rs::difference
symmetric_difference(self, other: Self) -> Self as im as im same tests/compat_ordset.rs::symmetric_difference
relative_complement(self, other: Self) -> Self in self, not in other as im as im same tests/compat_ordset.rs::relative_complement
intersection(self, other: Self) -> Self as im as im same tests/compat_ordset.rs::intersection
split<BA>(self, k: &BA) -> (Self, Self) < k, > k; equal dropped; consumes self as im as im same tests/compat_ordset.rs::split
split_member<BA>(self, k: &BA) -> (Self, bool, Self) plus whether k was present as im as im same tests/compat_ordset.rs::split_member
take(&self, n: usize) -> Self n smallest; all if n >= len as im as im same tests/compat_ordset.rs::take
skip(&self, n: usize) -> Self all but n smallest; empty if n >= len as im as im same tests/compat_ordset.rs::skip

Diff types and iterators

item im 15.1 imbl 7 perennial status test
ordset::DiffItem<'a, A> (enum Add(&A), Update { old, new }, Remove(&A)) Debug Add(25); PartialEq, Eq as im as im same tests/compat_ordset.rs::diff_item
ordset::DiffIter<'a, A> (Item DiffItem) Iterator DiffIter<'a, 'b, A, P>, also Fused as im's shape plus FusedIterator (01:loose-bounds) same tests/compat_ordset.rs::diff_iter
ordset::Iter<'a, A> (Item &A) Iterator, DoubleEnded, ExactSize adds Clone as im plus Clone same tests/compat_ordset.rs::iter_type
impl Clone for ordset::Iter absent present provided (01 "imbl additions kept") added (imbl API) tests/compat_ordset.rs::iter_impl_clone
ordset::RangedIter<'a, A> (Item &A) Iterator, DoubleEnded; no ExactSize as im type alias of ordset::Iter (also ExactSize) differs: alias of Iter (01:range-type) tests/compat_ordset.rs::ranged_iter_type
ordset::ConsumingIter<A> (Item A) Iterator only (no rev, no len) also DoubleEnded, ExactSize, Fused, Clone (7.0.2) Iterator plus the imbl traits (next rows) same tests/compat_ordset.rs::consuming_iter_type
impl DoubleEndedIterator + ExactSizeIterator + FusedIterator for ordset::ConsumingIter absent present; len() panicked before 7.0.2 provided, len() correct (01 "imbl additions kept") added (imbl API) tests/compat_ordset.rs::consuming_iter_double_ended_exact_size
impl Clone for ordset::ConsumingIter absent present provided (01 "imbl additions kept") added (imbl API) tests/compat_ordset.rs::consuming_iter_impl_clone

Trait implementations

item im 15.1 imbl 7 perennial status test
impl Clone O(1) as im as im same tests/compat_ordset.rs::impl_clone
impl Default as im as im same tests/compat_ordset.rs::impl_default
impl Debug (A: Ord + Debug) {1, 2, 3}, {} as im as im same tests/differential/ordset.rs
impl PartialEq element PartialEq over the sorted sequence (shared-structure short-cut) Ord only element PartialEq same tests/compat_ordset.rs::impl_partial_eq
impl Eq as im as im same tests/compat_ordset.rs::impl_eq
impl PartialOrd lexicographic ascending as im as im same tests/differential/ordset.rs
impl Ord lexicographic ascending as im as im same tests/differential/ordset.rs
impl Hash (A: Ord + Hash) ascending, no length prefix (≠ BTreeSet) as im as im same tests/compat_ordset.rs::impl_hash
impl Add for OrdSet<A> union as im as im same tests/compat_ordset.rs::impl_add
impl Add for &OrdSet<A> union as im as im same tests/compat_ordset.rs::impl_add_ref
impl Mul for OrdSet<A> intersection as im as im same tests/compat_ordset.rs::impl_mul
impl Mul for &OrdSet<A> intersection as im as im same tests/compat_ordset.rs::impl_mul_ref
impl Sum union of all as im as im same tests/compat_ordset.rs::impl_sum
impl Extend<R> (A: From<R>) as im as im same tests/compat_ordset.rs::impl_extend
impl FromIterator<R> last duplicate kept as im as im same tests/compat_ordset.rs::impl_from_iterator
impl IntoIterator for OrdSet ConsumingIter, ascending as im as im same tests/compat_ordset.rs::impl_into_iterator
impl IntoIterator for &OrdSet Iter as im as im same tests/compat_ordset.rs::impl_into_iterator_ref
impl From<Vec<A>> as im as im same tests/compat_ordset.rs::impl_from_vec
impl From<&Vec<A>> as im as im same tests/compat_ordset.rs::impl_from_vec_ref
impl From<&[A]> as im as im same tests/compat_ordset.rs::impl_from_slice
impl From<BTreeSet<A>> as im as im same tests/compat_ordset.rs::impl_from_btree_set
impl From<&BTreeSet<A>> as im as im same tests/compat_ordset.rs::impl_from_btree_set_ref
impl From<std::collections::HashSet<A>> as im as im same tests/compat_ordset.rs::impl_from_std_hash_set
impl From<&std::collections::HashSet<A>> as im as im same tests/compat_ordset.rs::impl_from_std_hash_set_ref
impl From<HashSet<A, S>> (crate's HashSet) as im as im same tests/compat_ordset_convert.rs::impl_from_hash_set
impl From<&HashSet<A, S>> as im as im same tests/compat_ordset_convert.rs::impl_from_hash_set_ref
impl From<&OrdSet<&A>> for OrdSet<OA> owning copy via ToOwned as im as im same tests/compat_ordset.rs::impl_from_set_of_refs
impl Serialize (feature serde) as a sequence as im as im same tests/compat_ordset_features.rs::impl_serialize
impl Deserialize (feature serde) from a sequence; duplicates collapse as im as im same tests/compat_ordset_features.rs::impl_deserialize
impl arbitrary::Arbitrary<'a> (feature arbitrary) yes yes yes same tests/compat_ordset_features.rs::impl_arbitrary
impl quickcheck::Arbitrary (feature quickcheck) im only yes both crates (01:features) same tests/compat_ordset_features.rs::impl_quickcheck_arbitrary
impl bincode::Encode / Decode (feature bincode) absent yes not provided not provided: imbl-only, not in im's API; not in 0.1 (01:imbl-only) —
auto traits Send / Sync im-rc neither; im when A is as im perennial-rc neither; perennial when A is same tests/compat_ordset.rs::auto_traits