UndoStack

Struct UndoStack 

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

Undo/redo stack with efficient memory management

Uses a circular buffer design with arena allocation for optimal performance. Supports configurable limits and automatic cleanup.

Implementations§

Source§

impl UndoStack

Source

pub fn new() -> Self

Create a new undo stack with default configuration

Source

pub fn with_config(config: UndoStackConfig) -> Self

Create a new undo stack with custom configuration

Source

pub fn push(&mut self, entry: HistoryEntry)

Push a new entry onto the undo stack

This clears the redo stack as new operations invalidate previously undone operations.

Source

pub fn pop_undo(&mut self) -> Option<HistoryEntry>

Pop the most recent entry from the undo stack

Source

pub fn push_redo(&mut self, entry: HistoryEntry)

Push an entry onto the redo stack

Source

pub fn pop_redo(&mut self) -> Option<HistoryEntry>

Pop an entry from the redo stack

Source

pub fn can_undo(&self) -> bool

Check if undo is available

Source

pub fn can_redo(&self) -> bool

Check if redo is available

Source

pub fn undo_count(&self) -> usize

Get the number of undo entries available

Source

pub fn redo_count(&self) -> usize

Get the number of redo entries available

Source

pub fn memory_usage(&self) -> usize

Get current memory usage in bytes

Source

pub fn next_undo_description(&self) -> Option<&str>

Get description of the next undo operation

Source

pub fn next_redo_description(&self) -> Option<&str>

Get description of the next redo operation

Source

pub fn clear(&mut self)

Clear all history

Source

pub fn arena(&self) -> &Bump

Available on crate feature arena only.

Get arena allocator reference

Source

pub fn arena_mut(&mut self) -> &mut Bump

Available on crate feature arena only.

Get mutable arena allocator reference

Trait Implementations§

Source§

impl Debug for UndoStack

Source§

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

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

impl Default for UndoStack

Source§

fn default() -> Self

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.