From 33c3c56b3177d3a62ff57ee51f844e4ffb853f0f Mon Sep 17 00:00:00 2001 From: ripytide Date: Fri, 31 Mar 2023 17:56:04 +0100 Subject: [PATCH] cloned the readme to the lib.rs --- README.md | 2 +- src/lib.rs | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 17478f7..6808e64 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ Here are a few examples of `RangeBounds` and whether they are valid: | 0..1 | YES | | 9..8 | NO | | (0.4)..=(-0.2) | NO | -| ..-3 | YES | +| ..(-3) | YES | | 0.0003.. | YES | | .. | YES | | 400..=400 | YES | diff --git a/src/lib.rs b/src/lib.rs index ff332b2..61a1e14 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -103,6 +103,30 @@ along with range_bounds_map. If not, see . //! //! ### Invalid RangeBounds //! +//! Within this crate, not all `RangeBounds` are considered valid +//! `RangeBounds`. The definition of the validity of a `RangeBounds` used +//! within this crate is that a `RangeBounds` is only valid if it contains +//! at least one value of the underlying domain. +//! +//! For example, `4..6` is considered valid as it contains the values `4` +//! and `5`, however, `4..4` is considered invalid as it contains no +//! values. Another example of invalid `RangeBounds` are those with +//! `start_bound()`s with greater values than their `end_bound()`s, such +//! as `5..2` or `100..=40`. +//! +//! Here are a few examples of `RangeBounds` and whether they are valid: +//! +//! | `RangeBounds` | Valid | +//! | -------------- | ----- | +//! | 0..0 | NO | +//! | 0..1 | YES | +//! | 9..8 | NO | +//! | (0.4)..=(-0.2) | NO | +//! | ..(-3) | YES | +//! | 0.0003.. | YES | +//! | .. | YES | +//! | 400..=400 | YES | +//! //! ### Overlap //! //! Two `RangeBounds` are "overlapping" if there exists a point that is @@ -120,6 +144,11 @@ along with range_bounds_map. If not, see . //! When a `RangeBounds` "merges" other `RangeBounds` it absorbs them //! to become larger. //! +//! ### Further Reading +//! +//! See Wikipedia's article on Intervals: +//! +//! //! # Improvements/Caveats //! //! - Missing some functions common to BTreeMap and BTreeSet like: @@ -155,6 +184,7 @@ along with range_bounds_map. If not, see . //! - //! Very similar to this crate but can only use [`Range`]s and //! [`RangeInclusive`]s as keys in it's `map` and `set` structs (separately). +//! - //! - //! Cool library for fully-generic ranges (unlike std::ops ranges), along //! with a `Ranges` datastructure for storing them (Vec-based