Trait ValuePtr

Source
pub trait ValuePtr {
    // Required methods
    fn len(&self) -> u32;
    fn deref(&self) -> Result<Vec<u8>, VMLogicError>;
}
Expand description

Logical pointer to a value in storage. Allows getting value length before getting the value itself. This is needed so that runtime can charge gas before accessing a potentially large value.

Required Methods§

Source

fn len(&self) -> u32

Returns the length of the value

Source

fn deref(&self) -> Result<Vec<u8>, VMLogicError>

Dereferences the pointer. Takes a box because currently runtime code uses dynamic dispatch.

§Errors

StorageError if reading from storage fails

Implementors§