Cache

Struct Cache 

Source
pub struct Cache<Memory: Clone> { /* private fields */ }
Expand description

Memory cache implementation

Trait Implementations§

Source§

impl<Memory: 'static + Clone> Cache<Memory> for Cache<Memory>

Source§

fn frame(&self) -> &Vec<Rc<RefCell<State<Memory>>>>

Get frame

Source§

fn frame_mut(&mut self) -> &mut Vec<Rc<RefCell<State<Memory>>>>

Get frame mut

Source§

fn memory(&self) -> Option<Memory>

Memory
Source§

fn flush(&mut self) -> Option<()>

(lifecycle) Flush data
Source§

impl<Memory: Clone> Default for Cache<Memory>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<Memory: 'static + Clone> Frame<Memory> for Cache<Memory>

Source§

fn active(&self) -> Option<[u8; 32]>

Source§

fn active_set(&self, key: [u8; 32], value: Vec<u8>) -> Option<Vec<u8>>

Source§

fn active_get(&self, key: &[u8]) -> Option<Vec<u8>>

Source§

fn push(&mut self, code_hash: [u8; 32], memory: Memory)

Source§

fn switch(&mut self, code_hash: [u8; 32]) -> Option<()>

Source§

fn back(&mut self) -> Option<()>

Source§

fn top(&mut self) -> Option<()>

Source§

impl<Memory: Clone> Storage for Cache<Memory>

Source§

fn set(&mut self, key: Vec<u8>, value: Vec<u8>) -> Option<Vec<u8>>

set K for V
Source§

fn remove(&mut self, key: &[u8]) -> Option<Vec<u8>>

Remove a key
Source§

fn get(&self, key: &[u8]) -> Option<Vec<u8>>

get V by K Read more

Auto Trait Implementations§

§

impl<Memory> Freeze for Cache<Memory>

§

impl<Memory> !RefUnwindSafe for Cache<Memory>

§

impl<Memory> !Send for Cache<Memory>

§

impl<Memory> !Sync for Cache<Memory>

§

impl<Memory> Unpin for Cache<Memory>

§

impl<Memory> !UnwindSafe for Cache<Memory>

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, 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.