pub struct Ranges { /* private fields */ }Expand description
A list of non intersecting exclusive Range<usize>s
The primary purpose of this struct is to serve parsers by
telling Duat which ranges need to be updated. This lets Duat
minimize as much as possible the amount of work done to update
the Text when it changes in a Buffer.
Implementations§
Source§impl Ranges
impl Ranges
Sourcepub fn set_min_len(&mut self, min: usize)
pub fn set_min_len(&mut self, min: usize)
Sets a minimum length to keep Ranges
Sourcepub fn add(&mut self, new: Range<usize>) -> bool
pub fn add(&mut self, new: Range<usize>) -> bool
Adds a range to the list of Range<usize>s
This range will be merged in with the others on the list, so it may bridge gaps between ranges or for longer ranges within, without allowing for the existance of intersecting ranges.
This function will return true if the Ranges were changed
by this addition.
Sourcepub fn extend(&mut self, ranges: impl IntoIterator<Item = Range<usize>>) -> bool
pub fn extend(&mut self, ranges: impl IntoIterator<Item = Range<usize>>) -> bool
Adds many Ranges to be merged with the existing ones
This function will return true if the Ranges were changed
by this addition.
Sourcepub fn remove_intersecting(
&mut self,
within: Range<usize>,
) -> impl Iterator<Item = Range<usize>>
pub fn remove_intersecting( &mut self, within: Range<usize>, ) -> impl Iterator<Item = Range<usize>>
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of Range<usize>s
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if there are no Range<usize>s
Sourcepub fn iter_over(
&self,
within: Range<usize>,
) -> impl Iterator<Item = Range<usize>>
pub fn iter_over( &self, within: Range<usize>, ) -> impl Iterator<Item = Range<usize>>
The same as Ranges::remove_on, but without removing, just
iterating over the relevant ranges
This method will trim the iterated Ranges to the bounds of
within. If you want a non trimmed version of this method,
check out iter_intersecting.
Sourcepub fn iter_intersecting(
&self,
within: Range<usize>,
) -> impl Iterator<Item = Range<usize>>
pub fn iter_intersecting( &self, within: Range<usize>, ) -> impl Iterator<Item = Range<usize>>
Iterates over all Ranges that intersect with within
If you want to automatically trim those ranges to the bounds
of within, check out iter_over. If you want to remove
the ranges that intersect with the given one, see,
Ranges::remove_intersecting
Trait Implementations§
Source§impl IntoIterator for Ranges
impl IntoIterator for Ranges
Source§impl Ord for Ranges
impl Ord for Ranges
Source§impl PartialOrd for Ranges
impl PartialOrd for Ranges
impl Eq for Ranges
Auto Trait Implementations§
impl Freeze for Ranges
impl RefUnwindSafe for Ranges
impl Send for Ranges
impl Sync for Ranges
impl Unpin for Ranges
impl UnwindSafe for Ranges
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§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.