UndoRedoHelper
struct · ferroui-controls · v0.5.0
struct UndoRedoHelper<TState>
Records snapshots of the state of a host and moves between them.
The host owns its helper, so the helper only holds a weak handle to the
host. No borrow of the helper is held while the host is called: the host
may call back into the helper from every member of IUndoRedoHost.
Members
DEFAULT_UNDO_LIMITnewunattachedset_hostlimitset_limitcan_undocan_redoundois_last_statetry_get_last_statehas_stateupdate_last_state_withupdate_last_statediscard_redoredosnapshotclear
DEFAULT_UNDO_LIMIT
const DEFAULT_UNDO_LIMIT: i32
new
fn new(host: Weak<dyn IUndoRedoHost<TState>>) -> Self
unattached
fn unattached() -> Self
Creates a helper whose host is set later with set_host
(Self::set_host): the field initialisers of a class run before its
handle exists.
set_host
fn set_host(self: &Self, host: Weak<dyn IUndoRedoHost<TState>>)
Sets the host of a helper created with unattached.
limit
fn limit(self: &Self) -> i32
Maximum number of states this helper can store for undo/redo. If -1, no limit is imposed.
set_limit
fn set_limit(self: &Self, value: i32)
can_undo
fn can_undo(self: &Self) -> bool
can_redo
fn can_redo(self: &Self) -> bool
undo
fn undo(self: &Self)
is_last_state
fn is_last_state(self: &Self) -> bool
try_get_last_state
fn try_get_last_state(self: &Self) -> Option<TState>
The current state when it is the last one (C# TryGetLastState(out state)).
has_state
fn has_state(self: &Self) -> bool
update_last_state_with
fn update_last_state_with(self: &Self, state: TState)
Replaces the last recorded state (C# UpdateLastState(TState)).
update_last_state
fn update_last_state(self: &Self)
Replaces the last recorded state with the state of the host
(C# UpdateLastState()).
discard_redo
fn discard_redo(self: &Self)
redo
fn redo(self: &Self)
snapshot
fn snapshot(self: &Self)
clear
fn clear(self: &Self)
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyClassDefaultsErasedDestructorIntoEither
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.