Struct Log

Source
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 LogState

Implementations§

Source§

impl<'a, S: StorageStack, T> Log<'a, S, T>

Source

pub fn new(state: &'a mut LogState, storage: &'a mut S) -> Self

Return Log by initializing it with a LogState and a StorageStack.

Source

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.

Source

pub fn size(&self) -> u64

Return number of entries in the log.

Source

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>

§

impl<'a, S, T> Send for Log<'a, S, T>
where S: Send, T: Send,

§

impl<'a, S, T> Sync for Log<'a, S, T>
where S: Sync, T: Sync,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.