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>)
pub fn add(&mut self, new: Range<usize>)
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.
Sourcepub fn remove(
&mut self,
within: Range<usize>,
) -> impl ExactSizeIterator<Item = Range<usize>> + '_
pub fn remove( &mut self, within: Range<usize>, ) -> impl ExactSizeIterator<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
Trait Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.