Struct rustc_index::interval::IntervalSet
source · pub struct IntervalSet<I> {
map: SmallVec<[(u32, u32); 4]>,
domain: usize,
_data: PhantomData<I>,
}
Expand description
Stores a set of intervals on the indices.
The elements in map
are sorted and non-adjacent, which means
the second value of the previous element is greater than the
first value of the following element.
Fields§
§map: SmallVec<[(u32, u32); 4]>
§domain: usize
§_data: PhantomData<I>
Implementations§
source§impl<I: Idx> IntervalSet<I>
impl<I: Idx> IntervalSet<I>
pub fn new(domain: usize) -> IntervalSet<I>
pub fn clear(&mut self)
pub fn iter(&self) -> impl Iterator<Item = I> + '_where
I: Step,
sourcepub fn iter_intervals(&self) -> impl Iterator<Item = Range<I>> + '_where
I: Step,
pub fn iter_intervals(&self) -> impl Iterator<Item = Range<I>> + '_where
I: Step,
Iterates through intervals stored in the set, in order.
sourcepub fn insert(&mut self, point: I) -> bool
pub fn insert(&mut self, point: I) -> bool
Returns true if we increased the number of elements present.
sourcepub fn insert_range(&mut self, range: impl RangeBounds<I> + Clone) -> bool
pub fn insert_range(&mut self, range: impl RangeBounds<I> + Clone) -> bool
Returns true if we increased the number of elements present.
pub fn contains(&self, needle: I) -> bool
pub fn superset(&self, other: &IntervalSet<I>) -> boolwhere
I: Step,
pub fn is_empty(&self) -> bool
sourcepub fn first_unset_in(&self, range: impl RangeBounds<I> + Clone) -> Option<I>
pub fn first_unset_in(&self, range: impl RangeBounds<I> + Clone) -> Option<I>
Equivalent to range.iter().find(|i| !self.contains(i))
.
sourcepub fn last_set_in(&self, range: impl RangeBounds<I> + Clone) -> Option<I>
pub fn last_set_in(&self, range: impl RangeBounds<I> + Clone) -> Option<I>
Returns the maximum (last) element present in the set from range
.
pub fn insert_all(&mut self)
pub fn union(&mut self, other: &IntervalSet<I>) -> boolwhere
I: Step,
fn check_invariants(&self) -> bool
Trait Implementations§
source§impl<I: Clone> Clone for IntervalSet<I>
impl<I: Clone> Clone for IntervalSet<I>
source§fn clone(&self) -> IntervalSet<I>
fn clone(&self) -> IntervalSet<I>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl<I> Freeze for IntervalSet<I>
impl<I> RefUnwindSafe for IntervalSet<I>where
I: RefUnwindSafe,
impl<I> Send for IntervalSet<I>where
I: Send,
impl<I> Sync for IntervalSet<I>where
I: Sync,
impl<I> Unpin for IntervalSet<I>where
I: Unpin,
impl<I> UnwindSafe for IntervalSet<I>where
I: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> Pointable for T
impl<T> Pointable for T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 48 bytes