superset_map

B-tree-backed map whose keys are distinct supersets.
git clone https://git.philomathiclife.com/repos/superset_map
Log | Files | Refs | README

commit 3f5fa3faed9434e1ea245518b8d3b1a010743c90
parent 29f246fe5105e39719018e882f3f7cfa4895e6d4
Author: Zack Newman <zack@philomathiclife.com>
Date:   Wed, 18 Oct 2023 16:14:16 -0600

minor cleanup

Diffstat:
MCargo.toml | 5++---
MREADME.md | 4++--
Msrc/lib.rs | 4++--
Msrc/superset_map.rs | 4++--
Msrc/superset_set.rs | 4++--
5 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml @@ -9,15 +9,14 @@ license = "MIT OR Apache-2.0" name = "superset_map" readme = "README.md" repository = "https://git.philomathiclife.com/repos/superset_map/" -rust-version = "1.69" -version = "0.2.0" +version = "0.2.1" [lib] name = "superset_map" path = "src/lib.rs" [dependencies] -zfc = { version = "0.3.0", default-features = false } +zfc = { version = "0.3.1", default-features = false } [dev-dependencies] num-bigint = { version = "0.4.4", default-features = false } diff --git a/README.md b/README.md @@ -1,7 +1,7 @@ # `superset_map` `superset_map` is a library for [`Set`](https://docs.rs/zfc/latest/zfc/trait.Set.html)s that have an order defined on them. -It's main data structure is [`SupersetMap`](https://docs.rs/superset_map/latest/superset_map/superset_map/struct.SupersetMap.html) +Its main data structure is [`SupersetMap`](https://docs.rs/superset_map/latest/superset_map/struct.SupersetMap.html) which is a specialized version of [`BTreeMap`](https://doc.rust-lang.org/alloc/collections/btree_map/struct.BTreeMap.html) where only supersets are stored. This can be useful when the keys don't fit well or at all with the concept of [`RangeBounds`](https://doc.rust-lang.org/stable/core/ops/trait.RangeBounds.html). @@ -140,4 +140,4 @@ they should work on any [Tier 1 with Host Tools](https://doc.rust-lang.org/beta/ target. Version `1.69.0` or newer of nightly `rustc` is required. Once -[`BTreeMap` cursors are stablilized](https://github.com/rust-lang/rust/issues/107540), stable `rustc` will work. +[`BTreeMap` cursors are stabilized](https://github.com/rust-lang/rust/issues/107540), stable `rustc` will work. diff --git a/src/lib.rs b/src/lib.rs @@ -1,7 +1,7 @@ //! # `superset_map` //! //! `superset_map` is a library for [`Set`]s that have an order defined on them. -//! It's main data structure is [`SupersetMap`] which is a specialized version of +//! Its main data structure is [`SupersetMap`] which is a specialized version of //! [`BTreeMap`](https://doc.rust-lang.org/alloc/collections/btree_map/struct.BTreeMap.html) //! where only supersets are stored. This can be useful when the keys don't fit well or at all with the concept of //! [`RangeBounds`](https://doc.rust-lang.org/stable/core/ops/trait.RangeBounds.html). @@ -157,7 +157,7 @@ )] use zfc::Set; /// A map of keys and values where the keys implement [`SetOrd`]. The map is backed by a B-tree. -pub mod superset_map; +mod superset_map; /// A set of values where the values implement [`SetOrd`]. The set is backed by a B-tree. pub mod superset_set; pub use superset_map::SupersetMap; diff --git a/src/superset_map.rs b/src/superset_map.rs @@ -45,7 +45,7 @@ use core::ops::{Bound, Index, RangeBounds}; /// will be inserted, a simple linear scan is sufficient /// to remove subsets avoiding the need to search /// the entire map. -#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct SupersetMap<K, V> { /// Collection of `(K, V)`s. map: BTreeMap<K, V>, @@ -743,7 +743,7 @@ mod tests { use core::cmp::Ordering; use num_bigint::BigUint; use zfc::{BoundedCardinality, Cardinality, Set}; - #[derive(PartialEq, Eq)] + #[derive(Eq, PartialEq)] struct ClosedInterval { min: usize, max: usize, diff --git a/src/superset_set.rs b/src/superset_set.rs @@ -223,7 +223,7 @@ impl<'a, T> Iterator for Range<'a, T> { /// will be inserted, a simple linear scan is sufficient /// to remove subsets avoiding the need to search /// the entire set. -#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] pub struct SupersetSet<T> { /// Collection of `T`s. map: SupersetMap<T, ()>, @@ -832,7 +832,7 @@ mod tests { use core::cmp::Ordering; use num_bigint::BigUint; use zfc::{BoundedCardinality, Cardinality, Set}; - #[derive(PartialEq, Eq)] + #[derive(Eq, PartialEq)] struct ClosedInterval { min: usize, max: usize,