[][src]Enum redo::Signal

pub enum Signal {
    Undo(bool),
    Redo(bool),
    Saved(bool),
    Cursor {
        old: usize,
        new: usize,
    },
    Root {
        old: usize,
        new: usize,
    },
}

The signal sent when the record, the history, or the receiver changes.

When one of these states changes, they will send a corresponding signal to the user. For example, if the record can no longer redo any commands, it sends a Redo(false) signal to tell the user.

Examples

let history = History::builder()
    .connect(|signal| match signal {
        Signal::Undo(on) => println!("undo: {}", on),
        Signal::Redo(on) => println!("redo: {}", on),
        Signal::Saved(on) => println!("saved: {}", on),
        Signal::Cursor { old, new } => println!("cursor: {} -> {}", old, new),
        Signal::Root { old, new } => println!("root: {} -> {}", old, new),
    })
    .default();

Variants

Undo(bool)

Says if the record can undo.

This signal will be emitted when the records ability to undo changes.

Redo(bool)

Says if the record can redo.

This signal will be emitted when the records ability to redo changes.

Saved(bool)

Says if the receiver is in a saved state.

This signal will be emitted when the record enters or leaves its receivers saved state.

Cursor

Says if the current command has changed.

This signal will be emitted when the cursor has changed. This includes when two commands have been merged, in which case old == new.

Fields of Cursor

old: usize

The old cursor.

new: usize

The new cursor.

Root

Says if the current branch, or root, has changed.

This is only emitted from History.

Fields of Root

old: usize

The old root.

new: usize

The new root.

Trait Implementations

impl Eq for Signal
[src]

impl PartialOrd<Signal> for Signal
[src]

impl Copy for Signal
[src]

impl PartialEq<Signal> for Signal
[src]

impl Clone for Signal
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Ord for Signal
[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl Debug for Signal
[src]

impl Hash for Signal
[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

Auto Trait Implementations

impl Send for Signal

impl Sync for Signal

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]