Type Alias egui::widgets::text_edit::state::Undoer

source ·
type Undoer = Undoer<(CCursorRange, String)>;

Aliased Type§

struct Undoer {
    settings: Settings,
    undos: VecDeque<(CCursorRange, String), Global>,
    flux: Option<Flux<(CCursorRange, String)>>,
}

Fields§

§settings: Settings§undos: VecDeque<(CCursorRange, String), Global>

New undoes are added to the back. Two adjacent undo points are never equal. The latest undo point may (often) be the current state.

§flux: Option<Flux<(CCursorRange, String)>>

Implementations§

source§

impl<State> Undoer<State>where State: Clone + PartialEq,

source

pub fn has_undo(&self, current_state: &State) -> bool

Do we have an undo point different from the given state?

source

pub fn is_in_flux(&self) -> bool

Return true if the state is currently changing

source

pub fn undo(&mut self, current_state: &State) -> Option<&State>

source

pub fn add_undo(&mut self, current_state: &State)

Add an undo point if, and only if, there has been a change since the latest undo point.

  • time: current time in seconds.
source

pub fn feed_state(&mut self, current_time: f64, current_state: &State)

Call this as often as you want (e.g. every frame) and Undoer will determine if a new undo point should be created.

  • current_time: current time in seconds.

Trait Implementations§

source§

impl<State: Clone> Clone for Undoer<State>

source§

fn clone(&self) -> Undoer<State>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<State> Debug for Undoer<State>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<State: Default> Default for Undoer<State>

source§

fn default() -> Undoer<State>

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