FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    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.

    View source

    Members

    DEFAULT_UNDO_LIMIT

    const DEFAULT_UNDO_LIMIT: i32
    

    Source

    new

    fn new(host: Weak<dyn IUndoRedoHost<TState>>) -> Self
    

    Source

    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.

    Source

    set_host

    fn set_host(self: &Self, host: Weak<dyn IUndoRedoHost<TState>>)
    

    Sets the host of a helper created with unattached.

    Source

    limit

    fn limit(self: &Self) -> i32
    

    Maximum number of states this helper can store for undo/redo. If -1, no limit is imposed.

    Source

    set_limit

    fn set_limit(self: &Self, value: i32)
    

    Source

    can_undo

    fn can_undo(self: &Self) -> bool
    

    Source

    can_redo

    fn can_redo(self: &Self) -> bool
    

    Source

    undo

    fn undo(self: &Self)
    

    Source

    is_last_state

    fn is_last_state(self: &Self) -> bool
    

    Source

    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)).

    Source

    has_state

    fn has_state(self: &Self) -> bool
    

    Source

    update_last_state_with

    fn update_last_state_with(self: &Self, state: TState)
    

    Replaces the last recorded state (C# UpdateLastState(TState)).

    Source

    update_last_state

    fn update_last_state(self: &Self)
    

    Replaces the last recorded state with the state of the host (C# UpdateLastState()).

    Source

    discard_redo

    fn discard_redo(self: &Self)
    

    Source

    redo

    fn redo(self: &Self)
    

    Source

    snapshot

    fn snapshot(self: &Self)
    

    Source

    clear

    fn clear(self: &Self)
    

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ClassDefaults
    • ErasedDestructor
    • IntoEither

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.