Skip to main content

Trail

Struct Trail 

Source
pub struct Trail { /* private fields */ }
Expand description

Focus history with browser-like back/forward behavior.

  • record(node) appends and moves the cursor.
  • If cursor isn’t at tail, forward history is dropped.
  • forget_node(node) removes all occurrences and preserves chain.

Implementations§

Source§

impl Trail

Source

pub fn new() -> Self

Source

pub fn cursor(&self) -> Option<NodeId>

Source

pub fn is_empty(&self) -> bool

Source

pub fn len(&self) -> usize

Source

pub fn entries(&self) -> Vec<NodeId>

Source

pub fn cursor_index(&self) -> Option<usize>

Source

pub fn node_at_index(&self, index: usize) -> Option<NodeId>

Source

pub fn seek_to_index(&mut self, index: usize) -> Option<NodeId>

Source

pub fn seek_to_node(&mut self, node: NodeId) -> bool

Source

pub fn record(&mut self, node: NodeId)

Record a focus visit.

Source

pub fn back(&mut self) -> Option<NodeId>

Step back in history.

Source

pub fn forward(&mut self) -> Option<NodeId>

Step forward in history.

Source

pub fn back_wrapping(&mut self) -> Option<NodeId>

Source

pub fn forward_wrapping(&mut self) -> Option<NodeId>

Source

pub fn truncate_to(&mut self, max_len: usize)

Source

pub fn forget_node(&mut self, node: NodeId)

Remove all history entries for a given node id.

Trait Implementations§

Source§

impl Default for Trail

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Trail

§

impl RefUnwindSafe for Trail

§

impl Send for Trail

§

impl Sync for Trail

§

impl Unpin for Trail

§

impl UnsafeUnpin for Trail

§

impl UnwindSafe for Trail

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.