zink::storage::mapping

Trait Mapping

Source
pub trait Mapping {
    type Key: Asm;
    type Value: StorageValue;

    const STORAGE_SLOT: i32;

    // Required method
    fn storage_key(key: Self::Key) -> [u8; 32];

    // Provided methods
    fn get(key: Self::Key) -> Self::Value { ... }
    fn set(key: Self::Key, value: Self::Value) { ... }
}
Expand description

Storage mapping interface

Required Associated Constants§

Required Associated Types§

Required Methods§

Source

fn storage_key(key: Self::Key) -> [u8; 32]

Provided Methods§

Source

fn get(key: Self::Key) -> Self::Value

Get value from storage key.

Source

fn set(key: Self::Key, value: Self::Value)

Set key and value

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§