diff --git a/src/lib.rs b/src/lib.rs index 6b0bf10..c58d5b8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -229,7 +229,7 @@ along with range_bounds_map. If not, see . #![allow(clippy::needless_return)] pub(crate) mod bound_ord; -pub(crate) mod helpers; +pub(crate) mod utils; pub mod test_ranges; pub mod range_bounds_map; diff --git a/src/range_bounds_map.rs b/src/range_bounds_map.rs index f80177f..d4b8064 100644 --- a/src/range_bounds_map.rs +++ b/src/range_bounds_map.rs @@ -34,7 +34,7 @@ use serde::ser::SerializeMap; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use crate::bound_ord::BoundOrd; -use crate::helpers::{ +use crate::utils::{ cmp_range_with_bound_ord, cut_range, flip_bound, is_valid_range, overlaps, }; use crate::TryFromBounds; @@ -411,14 +411,14 @@ where { invalid_range_panic(range); - let lower_comp = overlapping_start_comp(range.start()); - let upper_comp = overlapping_end_comp(range.end()); + let start_comp = overlapping_start_comp(range.start()); + let end_comp = overlapping_end_comp(range.end()); - let lower_bound = SearchBoundCustom::Included; - let upper_bound = SearchBoundCustom::Included; + let start_bound = SearchBoundCustom::Included; + let end_bound = SearchBoundCustom::Included; self.inner - .range(lower_comp, lower_bound, upper_comp, upper_bound) + .range(start_comp, start_bound, end_comp, end_bound) } /// Returns a reference to the `Value` corresponding to the @@ -1400,12 +1400,13 @@ where /// /// # Examples /// ``` + /// use range_bounds_map::test_ranges::ie; /// use range_bounds_map::{RangeBoundsMap, TryFromBoundsError}; /// /// let map = RangeBoundsMap::from_slice_strict([ - /// (1..4, false), - /// (4..8, true), - /// (8..100, false), + /// (ie(1, 4), false), + /// (ie(4, 8), true), + /// (ie(8, 100), false), /// ]) /// .unwrap(); /// ``` @@ -1649,7 +1650,7 @@ mod tests { use super::*; use crate::bound_ord::BoundOrd; - use crate::helpers::{config, Config, CutResult}; + use crate::utils::{config, Config, CutResult}; use crate::test_ranges::{ee, ei, ie, ii, iu, u, ue, ui, uu, AnyRange}; //only every other number to allow mathematical_overlapping_definition @@ -1844,8 +1845,8 @@ mod tests { } //make our expected_overlapping the correct order if expected_overlapping.len() > 1 { - if BoundOrd::start(expected_overlapping[0].start_bound()) - > BoundOrd::start(expected_overlapping[1].start_bound()) + if BoundOrd::start(expected_overlapping[0].start()) + > BoundOrd::start(expected_overlapping[1].start()) { expected_overlapping.swap(0, 1); } diff --git a/src/helpers.rs b/src/utils.rs similarity index 100% rename from src/helpers.rs rename to src/utils.rs diff --git a/todo.md b/todo.md deleted file mode 100644 index 373e02b..0000000 --- a/todo.md +++ /dev/null @@ -1,69 +0,0 @@ -# refactor - -- try to remove unnecessary uses of cloned() -- use expand, expand_cloned and cloned_bounds everywhere -- replace instances of |(key, \_)| with fn first() -- rename insert_overwrite to insert_forceful -- make all iterators cutsom types as is standardised in libraries for - some reason(?) -- take a look around idiomatic rust for a bit -- review method parameter names for all public functions -- make try_from_bounds trait return TryFromBoundsError rather than - mapping the option all the time - -# optimisations - -- make a StartBoundWrapper that uses BoundOrd to implement ord and - use that instead of storing the startbound twice - -# Documentation - -- replace `RangeBounds` with `K` where applicatble in docs -- replace rust types URL links with direct rust links -- normalize the description of the project beteen: - - the first line of the crate levele docs/readme - - the description meta-data section on github - - the descriptio meta-data field in the Cargo.toml - -# features - -- make specifc RangeMap, RangeSet, RangeInclusiveMap... types for signature - simplification - alternatively add just the one generic SafeRangeBoundsMap + Set that - just add unwraps everywhere to simplify signatures on known-"Safe" - symmetric types such as Range -- add rangemap's insert function to finally make range_bounds_map a superset of rangemap - -- add remove_at_point(), clear(), etc.. - -- add a multi-dimentional version of RandBounds{Map,Set} by compositing Normal 1D RangeBoundsSets together in a big Vec or something. - -# open questions - -- should we implement FromIterator? If so which insert should we use? - (At the moment we do implement it using insert_strict()) -- should append\_\* functions not change the base if they fail half way? - - -#### PUBLISH - -# after publish tasks - -- add links to [`RangeBoundsSet`] and map after docs.rs is live with - the docs, and generally check for dead links on docs and readme -- tell people in issues of other rangemap libraries about my library - stonks advertising - - - -# new todos - -- the docs annoy me with sometimes including "Basic usage:" and - sometimes not, this may not be unique just the btree_cursors - function docs though. -- no examples in the docs for Cursors and CursorsMut unlike Entry docs - for some other collections which have nice docs. -- remove unused dependencies -- update cut docs to say they just return (K, V) now -- same with gaps docs except with I instead of &I now - -- grep for docs on doubleiterator and change to single now