Struct rustc_typeck::util::snapshot_vec::SnapshotVecUnstable
[-] [+]
[src]
pub struct SnapshotVec<D> where D: SnapshotVecDelegate {
// some fields omitted
}
Methods
impl<D> SnapshotVec<D> where D: SnapshotVecDelegate
fn new(delegate: D) -> SnapshotVec<D>
fn record(&mut self, action: D::Undo)
fn push(&mut self, elem: D::Value) -> usize
fn get(&'a self, index: usize) -> &'a D::Value
fn get_mut(&'a mut self, index: usize) -> &'a mut D::Value
Returns a mutable pointer into the vec; whatever changes you make here cannot be undone
automatically, so you should be sure call record()
with some sort of suitable undo
action.
fn set(&mut self, index: usize, new_elem: D::Value)
Updates the element at the given index. The old value will saved (and perhaps restored) if a snapshot is active.
fn start_snapshot(&mut self) -> Snapshot
fn actions_since_snapshot(&self, snapshot: &Snapshot) -> &[UndoLog<D>]
fn rollback_to(&mut self, snapshot: Snapshot)
fn commit(&mut self, snapshot: Snapshot)
Commits all changes since the last snapshot. Of course, they can still be undone if there is a snapshot further out.