Struct rustc_trans::util::snapshot_vec::SnapshotVecExperimental [-]  [+] [src]

pub struct SnapshotVec<T, U, D> {
    // some fields omitted
}

Methods

impl<T, U, D: SnapshotVecDelegate<T, U>> SnapshotVec<T, U, D>

fn new(delegate: D) -> SnapshotVec<T, U, D>

fn record(&mut self, action: U)

fn push(&mut self, elem: T) -> uint

fn get(&'a self, index: uint) -> &'a T

fn get_mut(&'a mut self, index: uint) -> &'a mut T

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: uint, new_elem: T)

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<T, U>]

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.