pub struct UndoLog { /* private fields */ }Expand description
Bounded, most-recent-last undo history.
Implementations§
Source§impl UndoLog
impl UndoLog
Sourcepub fn new(max_entries: usize) -> Self
pub fn new(max_entries: usize) -> Self
A log keeping at most max_entries operations; zero disables history.
Sourcepub fn record(
&mut self,
operation: UndoableOperation,
description: impl Into<String>,
) -> u64
pub fn record( &mut self, operation: UndoableOperation, description: impl Into<String>, ) -> u64
Record an operation; empty operations are ignored. Returns its id.
Sourcepub fn push(&mut self, entry: UndoEntry)
pub fn push(&mut self, entry: UndoEntry)
Put an entry back, e.g. the remainder of a partially failed undo.
pub fn record_move(&mut self, moves: Vec<(PathBuf, PathBuf)>) -> u64
pub fn record_copy(&mut self, created: Vec<PathBuf>) -> u64
pub fn record_trash(&mut self, paths: Vec<PathBuf>) -> u64
pub fn record_renames(&mut self, renames: Vec<(PathBuf, PathBuf)>) -> u64
pub fn record_create_file(&mut self, path: PathBuf) -> u64
pub fn record_create_directory(&mut self, path: PathBuf) -> u64
Sourcepub fn pop(&mut self) -> Option<UndoEntry>
pub fn pop(&mut self) -> Option<UndoEntry>
Remove and return the most recent entry if it can be undone here.
pub fn peek(&self) -> Option<&UndoEntry>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn clear(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UndoLog
impl RefUnwindSafe for UndoLog
impl Send for UndoLog
impl Sync for UndoLog
impl Unpin for UndoLog
impl UnsafeUnpin for UndoLog
impl UnwindSafe for UndoLog
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