pub struct DiscreteRangeSet<I, K> { /* private fields */ }
Expand description

An ordered set of non-overlapping ranges based on DiscreteRangeMap.

I is the generic type parameter for the Ord type the K type is range over.

K is the generic type parameter for the range implementing type in the set.

Phrasing it another way: I is the point type and K is the range type.

See DiscreteRangeMap for more details.

Implementations§

source§

impl<I, K> DiscreteRangeSet<I, K>
where I: PointType, K: RangeType<I>,

source

pub fn overlaps<Q>(&self, range: Q) -> bool
where Q: RangeType<I>,

See DiscreteRangeMap::overlaps() for more details.

source

pub fn overlapping<Q>(&self, range: Q) -> impl DoubleEndedIterator<Item = &K>
where Q: RangeType<I>,

See DiscreteRangeMap::overlapping() for more details.

source

pub fn get_at_point(&self, point: I) -> Result<&K, K>

source

pub fn contains_point(&self, point: I) -> bool

See DiscreteRangeMap::contains_point() for more details.

source

pub fn remove_overlapping<'a, Q>( &'a mut self, range: Q ) -> impl Iterator<Item = K> + '_
where Q: RangeType<I> + 'a,

source

pub fn cut<'a, Q>(&'a mut self, range: Q) -> impl Iterator<Item = K> + '_
where Q: RangeType<I> + 'a,

See DiscreteRangeMap::cut() for more details.

source

pub fn gaps<'a, Q>(&'a self, range: Q) -> impl Iterator<Item = K> + '_
where Q: RangeType<I> + 'a,

See DiscreteRangeMap::gaps() for more details.

source

pub fn contains_range<Q>(&self, range: Q) -> bool
where Q: RangeType<I>,

See DiscreteRangeMap::contains_range() for more details.

source

pub fn insert_strict(&mut self, range: K) -> Result<(), OverlapError>

See DiscreteRangeMap::insert_strict() for more details.

source

pub fn insert_merge_touching(&mut self, range: K) -> Result<K, OverlapError>

source

pub fn insert_merge_overlapping(&mut self, range: K) -> K

source

pub fn insert_merge_touching_or_overlapping(&mut self, range: K) -> K

source

pub fn insert_overwrite(&mut self, range: K)

source

pub fn from_slice_strict<const N: usize>( slice: [K; N] ) -> Result<DiscreteRangeSet<I, K>, OverlapError>

source

pub fn from_iter_strict( iter: impl Iterator<Item = K> ) -> Result<DiscreteRangeSet<I, K>, OverlapError>

source§

impl<I, K> DiscreteRangeSet<I, K>

source

pub fn new() -> Self

See DiscreteRangeMap::new() for more details.

source

pub fn len(&self) -> usize

See DiscreteRangeMap::len() for more details.

source

pub fn is_empty(&self) -> bool

See DiscreteRangeMap::is_empty() for more details.

source

pub fn iter(&self) -> impl DoubleEndedIterator<Item = &K>

See DiscreteRangeMap::iter() for more details.

source

pub fn first(&self) -> Option<&K>

See DiscreteRangeMap::first_entry() for more details.

source

pub fn last(&self) -> Option<&K>

See DiscreteRangeMap::last_entry() for more details.

Trait Implementations§

source§

impl<I: Clone, K: Clone> Clone for DiscreteRangeSet<I, K>

source§

fn clone(&self) -> DiscreteRangeSet<I, K>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<I: Debug, K: Debug> Debug for DiscreteRangeSet<I, K>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<I, K> Default for DiscreteRangeSet<I, K>
where I: PointType,

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de, I, K> Deserialize<'de> for DiscreteRangeSet<I, K>
where I: PointType, K: RangeType<I> + Deserialize<'de>,

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<I, K> IntoIterator for DiscreteRangeSet<I, K>

§

type Item = K

The type of the elements being iterated over.
§

type IntoIter = IntoIter<I, K>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<I: PartialEq, K: PartialEq> PartialEq for DiscreteRangeSet<I, K>

source§

fn eq(&self, other: &DiscreteRangeSet<I, K>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<I, K> Serialize for DiscreteRangeSet<I, K>
where K: Serialize,

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<I: Eq, K: Eq> Eq for DiscreteRangeSet<I, K>

source§

impl<I, K> StructuralEq for DiscreteRangeSet<I, K>

source§

impl<I, K> StructuralPartialEq for DiscreteRangeSet<I, K>

Auto Trait Implementations§

§

impl<I, K> RefUnwindSafe for DiscreteRangeSet<I, K>

§

impl<I, K> Send for DiscreteRangeSet<I, K>
where I: Send, K: Send,

§

impl<I, K> Sync for DiscreteRangeSet<I, K>
where I: Sync, K: Sync,

§

impl<I, K> Unpin for DiscreteRangeSet<I, K>
where I: Unpin,

§

impl<I, K> UnwindSafe for DiscreteRangeSet<I, K>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,