pub trait Cursor: Iterator {
// Required methods
fn prev(&mut self) -> Option<Self::Item>;
fn text_offset(&self) -> usize;
// Provided methods
fn peek_next(&mut self) -> Option<Self::Item> { ... }
fn peek_prev(&mut self) -> Option<Self::Item> { ... }
}Expand description
Trait for a cursor (akin to an Iterator, not the blinking thing).
This is not a DoubleEndedIterator which can iterate from both ends of the iterator, but moves a cursor forward/back over the collection.
Required Methods§
Sourcefn text_offset(&self) -> usize
fn text_offset(&self) -> usize
Offset of the current cursor position into the underlying text.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".