pub struct UndoManager { /* private fields */ }Expand description
An undo manager for a single document.
Implementations§
Source§impl UndoManager
impl UndoManager
Sourcepub fn new(
document_id: impl Into<String>,
replica_id: impl Into<String>,
) -> Self
pub fn new( document_id: impl Into<String>, replica_id: impl Into<String>, ) -> Self
Create a new undo manager.
Sourcepub fn set_max_history(&mut self, max: usize)
pub fn set_max_history(&mut self, max: usize)
Set the maximum history size.
Sourcepub fn record(&mut self, operation: UndoableOperation) -> &Operation
pub fn record(&mut self, operation: UndoableOperation) -> &Operation
Record a local operation.
Sourcepub fn record_remote(&mut self, operation: Operation)
pub fn record_remote(&mut self, operation: Operation)
Record a remote operation (from another replica).
Sourcepub fn start_group(&mut self) -> GroupId
pub fn start_group(&mut self) -> GroupId
Start a new operation group.
Sourcepub fn undo(&mut self) -> Vec<UndoableOperation>
pub fn undo(&mut self) -> Vec<UndoableOperation>
Undo the last operation (or group). Returns the inverse operations to apply.
Sourcepub fn redo(&mut self) -> Vec<UndoableOperation>
pub fn redo(&mut self) -> Vec<UndoableOperation>
Redo the last undone operation. Returns the operations to reapply.
Sourcepub fn undo_stack_size(&self) -> usize
pub fn undo_stack_size(&self) -> usize
Get the undo stack size.
Sourcepub fn redo_stack_size(&self) -> usize
pub fn redo_stack_size(&self) -> usize
Get the redo stack size.
Trait Implementations§
Source§impl Clone for UndoManager
impl Clone for UndoManager
Source§fn clone(&self) -> UndoManager
fn clone(&self) -> UndoManager
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for UndoManager
impl RefUnwindSafe for UndoManager
impl Send for UndoManager
impl Sync for UndoManager
impl Unpin for UndoManager
impl UnwindSafe for UndoManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more