pub struct VersionedChain<T: Clone> { /* private fields */ }Expand description
Linked list of (version, value) nodes ordered newest-first.
Time-travel reads walk the chain until they find a version <=
the query snapshot.
Implementations§
Source§impl<T: Clone> VersionedChain<T>
impl<T: Clone> VersionedChain<T>
pub fn new() -> Self
Sourcepub fn push(&self, value: T, new_version: u64)
pub fn push(&self, value: T, new_version: u64)
Add a new version to the head. new_version must strictly
exceed the current head’s version.
Sourcepub fn read_at(&self, snapshot_version: u64) -> Option<T>
pub fn read_at(&self, snapshot_version: u64) -> Option<T>
Read the value visible at snapshot_version. Walks back
through history until a node with version <= snapshot is found.
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for VersionedChain<T>
impl<T> !RefUnwindSafe for VersionedChain<T>
impl<T> Send for VersionedChain<T>
impl<T> Sync for VersionedChain<T>
impl<T> Unpin for VersionedChain<T>
impl<T> UnsafeUnpin for VersionedChain<T>
impl<T> UnwindSafe for VersionedChain<T>where
T: RefUnwindSafe,
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