StorageIntermediate

Trait StorageIntermediate 

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

Source

fn len(&self) -> usize

Source

fn is_empty(&self) -> bool

Source

fn copy_to_slice(&self, buffer: &mut [u8])

Provided Methods§

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.

Implementors§