Trait Cursor

Source
pub trait Cursor: Iterator {
    // Required methods
    fn prev(&mut self) -> Option<Self::Item>;
    fn rev_cursor(self) -> impl Cursor<Item = Self::Item>
       where Self: Sized;
    fn text_offset(&self) -> usize;
}
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§

Source

fn prev(&mut self) -> Option<Self::Item>

Return the previous item.

Source

fn rev_cursor(self) -> impl Cursor<Item = Self::Item>
where Self: Sized,

Return a cursor with prev/next reversed. All iterator functions work backwards.

Source

fn text_offset(&self) -> usize

Offset of the current cursor position into the underlying text.

Implementors§