pub struct Log<'a, S, T> {
pub state: &'a mut LogState,
/* private fields */
}Expand description
A generic log parameterized by its storage type S and log entry type T.
Fields§
§state: &'a mut LogStateImplementations§
Source§impl<'a, S: StorageStack, T> Log<'a, S, T>
impl<'a, S: StorageStack, T> Log<'a, S, T>
Sourcepub fn new(state: &'a mut LogState, storage: &'a mut S) -> Self
pub fn new(state: &'a mut LogState, storage: &'a mut S) -> Self
Return Log by initializing it with a LogState and a StorageStack.
Sourcepub fn push(&mut self, entry: T) -> Option<()>where
T: ArgumentEncoder,
pub fn push(&mut self, entry: T) -> Option<()>where
T: ArgumentEncoder,
Add a new entry to the log.
Return None if the log is full, or storage is full.
Sourcepub fn get(&self, index: u64) -> Option<T>where
T: for<'de> ArgumentDecoder<'de>,
pub fn get(&self, index: u64) -> Option<T>where
T: for<'de> ArgumentDecoder<'de>,
Look up a log entry by index.
Return None if the index is out of range, or it fails to read the entry.
Auto Trait Implementations§
impl<'a, S, T> Freeze for Log<'a, S, T>
impl<'a, S, T> RefUnwindSafe for Log<'a, S, T>where
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, S, T> Send for Log<'a, S, T>
impl<'a, S, T> Sync for Log<'a, S, T>
impl<'a, S, T> Unpin for Log<'a, S, T>where
T: Unpin,
impl<'a, S, T> !UnwindSafe for Log<'a, S, T>
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