Type Alias range_collections::range_set::RangeSet2
source · pub type RangeSet2<T> = RangeSet<[T; 2]>;Expand description
A range set that stores up to 2 boundaries inline
Aliased Type§
struct RangeSet2<T>(/* private fields */);Implementations§
source§impl<T, A: Array<Item = T>> RangeSet<A>
impl<T, A: Array<Item = T>> RangeSet<A>
sourcepub fn new(boundaries: SmallVec<A>) -> Option<Self>where
A::Item: Ord,
pub fn new(boundaries: SmallVec<A>) -> Option<Self>where A::Item: Ord,
create a new range set from the given boundaries
This performs a check that the boundaries are strictly sorted.
If you want to avoid this check, use new_unchecked
(behind a feature flag because it is unsafe)
sourcepub fn into_inner(self) -> SmallVec<A>
pub fn into_inner(self) -> SmallVec<A>
get the boundaries in this range set as a SmallVec
source§impl<T: RangeSetEntry, A: Array<Item = T>> RangeSet<A>
impl<T: RangeSetEntry, A: Array<Item = T>> RangeSet<A>
source§impl<T: RangeSetEntry + Clone, A: Array<Item = T>> RangeSet<A>
impl<T: RangeSetEntry + Clone, A: Array<Item = T>> RangeSet<A>
sourcepub fn intersection_with(&mut self, that: &RangeSetRef<T>)
pub fn intersection_with(&mut self, that: &RangeSetRef<T>)
intersection in place
sourcepub fn union_with(&mut self, that: &RangeSetRef<T>)
pub fn union_with(&mut self, that: &RangeSetRef<T>)
union in place
sourcepub fn difference_with(&mut self, that: &RangeSetRef<T>)
pub fn difference_with(&mut self, that: &RangeSetRef<T>)
difference in place
sourcepub fn symmetric_difference_with(&mut self, that: &RangeSetRef<T>)
pub fn symmetric_difference_with(&mut self, that: &RangeSetRef<T>)
symmetric difference in place (xor)
Methods from Deref<Target = RangeSetRef<T>>§
sourcepub fn split(&self, at: T) -> (&Self, &Self)where
T: Ord,
pub fn split(&self, at: T) -> (&Self, &Self)where T: Ord,
Split this range set into two parts left, right at position at,
so that left is identical to self for all x < at
and right is identical to self for all x >= at.
More precisely: contains(left, x) == contains(ranges, x) for x < at contains(right, x) == contains(ranges, x) for x >= at
This is not the same as limiting the ranges to the left or right of
at, but it is much faster. It requires just a binary search and no
allocations.
sourcepub fn boundaries(&self) -> &[T]
pub fn boundaries(&self) -> &[T]
The boundaries of the range set, guaranteed to be strictly sorted
sourcepub fn contains(&self, value: &T) -> boolwhere
T: Ord,
pub fn contains(&self, value: &T) -> boolwhere T: Ord,
true if the value is contained in the range set
sourcepub fn is_all(&self) -> boolwhere
T: RangeSetEntry,
pub fn is_all(&self) -> boolwhere T: RangeSetEntry,
true if the range set contains all values
sourcepub fn intersects(&self, that: &RangeSetRef<T>) -> boolwhere
T: Ord,
pub fn intersects(&self, that: &RangeSetRef<T>) -> boolwhere T: Ord,
true if this range set intersects from another range set
This is just the opposite of is_disjoint, but is provided for
better discoverability.
sourcepub fn is_disjoint(&self, that: &RangeSetRef<T>) -> boolwhere
T: Ord,
pub fn is_disjoint(&self, that: &RangeSetRef<T>) -> boolwhere T: Ord,
true if this range set is disjoint from another range set
sourcepub fn is_subset(&self, that: &RangeSetRef<T>) -> boolwhere
T: Ord,
pub fn is_subset(&self, that: &RangeSetRef<T>) -> boolwhere T: Ord,
true if this range set is a superset of another range set
A range set is considered to be a superset of itself
sourcepub fn is_superset(&self, that: &RangeSetRef<T>) -> boolwhere
T: Ord,
pub fn is_superset(&self, that: &RangeSetRef<T>) -> boolwhere T: Ord,
true if this range set is a subset of another range set
A range set is considered to be a subset of itself
sourcepub fn intersection<A>(&self, that: &RangeSetRef<T>) -> RangeSet<A>where
A: Array<Item = T>,
T: Ord + Clone,
pub fn intersection<A>(&self, that: &RangeSetRef<T>) -> RangeSet<A>where A: Array<Item = T>, T: Ord + Clone,
intersection
sourcepub fn union<A>(&self, that: &RangeSetRef<T>) -> RangeSet<A>where
A: Array<Item = T>,
T: Ord + Clone,
pub fn union<A>(&self, that: &RangeSetRef<T>) -> RangeSet<A>where A: Array<Item = T>, T: Ord + Clone,
union
sourcepub fn difference<A>(&self, that: &RangeSetRef<T>) -> RangeSet<A>where
A: Array<Item = T>,
T: Ord + Clone,
pub fn difference<A>(&self, that: &RangeSetRef<T>) -> RangeSet<A>where A: Array<Item = T>, T: Ord + Clone,
difference
sourcepub fn symmetric_difference<A>(&self, that: &RangeSetRef<T>) -> RangeSet<A>where
A: Array<Item = T>,
T: Ord + Clone,
pub fn symmetric_difference<A>(&self, that: &RangeSetRef<T>) -> RangeSet<A>where A: Array<Item = T>, T: Ord + Clone,
symmetric difference (xor)
Trait Implementations§
source§impl<T, A: Array<Item = T>> AsRef<RangeSetRef<T>> for RangeSet<A>
impl<T, A: Array<Item = T>> AsRef<RangeSetRef<T>> for RangeSet<A>
source§fn as_ref(&self) -> &RangeSetRef<T>
fn as_ref(&self) -> &RangeSetRef<T>
source§impl<T: Ord, A: Array<Item = T>> BitAndAssign<RangeSet<A>> for RangeSet<A>
impl<T: Ord, A: Array<Item = T>> BitAndAssign<RangeSet<A>> for RangeSet<A>
source§fn bitand_assign(&mut self, that: Self)
fn bitand_assign(&mut self, that: Self)
&= operation. Read moresource§impl<T: Ord, A: Array<Item = T>> BitOrAssign<RangeSet<A>> for RangeSet<A>
impl<T: Ord, A: Array<Item = T>> BitOrAssign<RangeSet<A>> for RangeSet<A>
source§fn bitor_assign(&mut self, that: Self)
fn bitor_assign(&mut self, that: Self)
|= operation. Read moresource§impl<T: RangeSetEntry, A: Array<Item = T>> BitXorAssign<RangeSet<A>> for RangeSet<A>
impl<T: RangeSetEntry, A: Array<Item = T>> BitXorAssign<RangeSet<A>> for RangeSet<A>
source§fn bitxor_assign(&mut self, that: Self)
fn bitxor_assign(&mut self, that: Self)
^= operation. Read moresource§impl<T, A: Array<Item = T>> Borrow<RangeSetRef<T>> for RangeSet<A>
impl<T, A: Array<Item = T>> Borrow<RangeSetRef<T>> for RangeSet<A>
source§fn borrow(&self) -> &RangeSetRef<T>
fn borrow(&self) -> &RangeSetRef<T>
source§impl<T: RangeSetEntry, A: Array<Item = T>> From<RangeSetRange<T>> for RangeSet<A>
impl<T: RangeSetEntry, A: Array<Item = T>> From<RangeSetRange<T>> for RangeSet<A>
source§fn from(value: RangeSetRange<T>) -> Self
fn from(value: RangeSetRange<T>) -> Self
source§impl<T: RangeSetEntry + Clone, A: Array<Item = T>> Not for RangeSet<A>
impl<T: RangeSetEntry + Clone, A: Array<Item = T>> Not for RangeSet<A>
compute the negation of this range set
∀ t ∈ T, r(t) = !a(t)
source§impl<A: Array, R: AsRef<RangeSetRef<A::Item>>> PartialEq<R> for RangeSet<A>where
A::Item: RangeSetEntry,
impl<A: Array, R: AsRef<RangeSetRef<A::Item>>> PartialEq<R> for RangeSet<A>where A::Item: RangeSetEntry,
source§impl<T: Ord, A: Array<Item = T>> SubAssign<RangeSet<A>> for RangeSet<A>
impl<T: Ord, A: Array<Item = T>> SubAssign<RangeSet<A>> for RangeSet<A>
source§fn sub_assign(&mut self, that: Self)
fn sub_assign(&mut self, that: Self)
-= operation. Read more