pub struct StorageCache;Expand description
Global accessor to persistent storage that relies on VM-level caching.
Implementations§
Source§impl StorageCache
impl StorageCache
Sourcepub fn flush()
👎Deprecated since 0.8.0: Use the .vm() method available on Stylus contracts instead to access host environment methods
pub fn flush()
Flushes the VM cache, persisting all values to the EVM state trie.
Note: this is used at the end of the entrypoint macro and is not typically called by user code.
Sourcepub fn clear()
👎Deprecated since 0.8.0: Use the .vm() method available on Stylus contracts instead to access host environment methods
pub fn clear()
Flushes and clears the VM cache, persisting all values to the EVM state trie. This is useful in cases of reentrancy to ensure cached values from one call context show up in another.
Trait Implementations§
Source§impl GlobalStorage for StorageCache
impl GlobalStorage for StorageCache
Source§unsafe fn get_uint<const B: usize, const L: usize>(
host: VM,
key: U256,
offset: usize,
) -> Uint<B, L>
unsafe fn get_uint<const B: usize, const L: usize>( host: VM, key: U256, offset: usize, ) -> Uint<B, L>
Source§unsafe fn get_signed<const B: usize, const L: usize>(
host: VM,
key: U256,
offset: usize,
) -> Signed<B, L>
unsafe fn get_signed<const B: usize, const L: usize>( host: VM, key: U256, offset: usize, ) -> Signed<B, L>
Source§unsafe fn set_uint<const B: usize, const L: usize>(
host: VM,
key: U256,
offset: usize,
value: Uint<B, L>,
)
unsafe fn set_uint<const B: usize, const L: usize>( host: VM, key: U256, offset: usize, value: Uint<B, L>, )
Source§unsafe fn set_signed<const B: usize, const L: usize>(
host: VM,
key: U256,
offset: usize,
value: Signed<B, L>,
)
unsafe fn set_signed<const B: usize, const L: usize>( host: VM, key: U256, offset: usize, value: Signed<B, L>, )
Auto Trait Implementations§
impl Freeze for StorageCache
impl RefUnwindSafe for StorageCache
impl Send for StorageCache
impl Sync for StorageCache
impl Unpin for StorageCache
impl UnwindSafe for StorageCache
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more