Skip to main content

History

Struct History 

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

An undo/redo history recorded as inverse operations in a value-backed ledger.

Implementations§

Source§

impl History

Source

pub fn new() -> Self

An empty history.

Source

pub fn commit<T: Transport>( &mut self, transport: &mut T, resource: &Symbol, new_value: Expr, ) -> Result<()>

Commit a new value for resource through transport, recording the forward and inverse operations. Clears the redo stack.

Source

pub fn undo<T: Transport>( &mut self, transport: &mut T, ) -> Result<Option<Symbol>>

Undo the most recent edit by replaying its inverse operation. Returns the resource that changed, or None if there is nothing to undo.

Source

pub fn redo<T: Transport>( &mut self, transport: &mut T, ) -> Result<Option<Symbol>>

Redo the most recently undone edit by replaying its forward operation.

Source

pub fn can_undo(&self) -> bool

Whether there is an edit to undo.

Source

pub fn can_redo(&self) -> bool

Whether there is an edit to redo.

Source

pub fn as_value(&self) -> Expr

The ledger as a value: the ordered list of recorded operations (the object edit history / session event log).

Trait Implementations§

Source§

impl Default for History

Source§

fn default() -> History

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

Auto Trait Implementations§

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.