Struct ra_ap_rustc_index::interval::IntervalSet
source · pub struct IntervalSet<I> { /* private fields */ }
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.
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,
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>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
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
Mutably borrows from an owned value. Read more