pub trait StorageStack {
// Required methods
fn new_with(&self, offset: Offset) -> Self;
fn offset(&self) -> Offset;
fn push<T>(&mut self, t: T) -> Result<(), Error>
where T: ArgumentEncoder;
fn pop<T>(&mut self) -> Result<T, Error>
where T: for<'de> ArgumentDecoder<'de>;
fn seek_prev(&mut self) -> Result<(), Error>;
}Expand description
Stack interface for stable memory that supports push and pop of arbitrary values that implement the Candid interface.
Required Methods§
Sourcefn new_with(&self, offset: Offset) -> Self
fn new_with(&self, offset: Offset) -> Self
Return a new StorageStack object with the given offset.
Sourcefn push<T>(&mut self, t: T) -> Result<(), Error>where
T: ArgumentEncoder,
fn push<T>(&mut self, t: T) -> Result<(), Error>where
T: ArgumentEncoder,
Push a value to the end of the stack.
Sourcefn pop<T>(&mut self) -> Result<T, Error>where
T: for<'de> ArgumentDecoder<'de>,
fn pop<T>(&mut self) -> Result<T, Error>where
T: for<'de> ArgumentDecoder<'de>,
Pop a value from the end of the stack.
In case of OutOfBounds error, offset is not changed.
In case of Candid decoding error, offset may be changed.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.