Trait rustc_data_structures::undo_log::UndoLogs
source · pub trait UndoLogs<T> {
// Required methods
fn num_open_snapshots(&self) -> usize;
fn push(&mut self, undo: T);
fn clear(&mut self);
// Provided methods
fn in_snapshot(&self) -> bool { ... }
fn extend<I>(&mut self, undos: I)
where Self: Sized,
I: IntoIterator<Item = T> { ... }
}
Expand description
A trait which allows undo actions (T
) to be pushed which can be used to rollback actions at a
later time if needed.
The undo actions themselves are opaque to UndoLogs
, only specified Rollback
implementations
need to know what an action is and how to reverse it.
Required Methods§
sourcefn num_open_snapshots(&self) -> usize
fn num_open_snapshots(&self) -> usize
How many open snapshots this undo log currently has
Provided Methods§
sourcefn in_snapshot(&self) -> bool
fn in_snapshot(&self) -> bool
True if a snapshot has started, false otherwise
sourcefn extend<I>(&mut self, undos: I)where
Self: Sized,
I: IntoIterator<Item = T>,
fn extend<I>(&mut self, undos: I)where
Self: Sized,
I: IntoIterator<Item = T>,
Extends the undo log with many undos.