pub trait StorageIntermediate: Sized {
// Required methods
fn len(&self) -> usize;
fn is_empty(&self) -> bool;
fn copy_to_slice(&self, buffer: &mut [u8]);
// Provided methods
fn to_vec(&self) -> Vec<u8> { ... }
fn to_value<T: BorshDeserialize>(&self) -> Result<T, BorshDeserializeError> { ... }
}Expand description
The purpose of this trait is to represent a reference to a value that could be obtained by IO, but without eagerly loading it into memory. For example, the NEAR runtime registers API allows querying the length of some bytes read from input or storage without loading them into the wasm memory.
Required Methods§
fn len(&self) -> usize
fn is_empty(&self) -> bool
fn copy_to_slice(&self, buffer: &mut [u8])
Provided Methods§
fn to_vec(&self) -> Vec<u8>
fn to_value<T: BorshDeserialize>(&self) -> Result<T, BorshDeserializeError>
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.