StorageMap

Trait StorageMap 

Source
pub trait StorageMap {
    type KEY: Decode + Encode;
    type VALUE: Decode;

    const PALLET_NAME: &'static str;
    const STORAGE_NAME: &'static str;
    const KEY_HASHER: StorageHasher;

    // Provided methods
    fn encode_partial_key() -> [u8; 32] { ... }
    fn hex_encode_partial_key() -> String { ... }
    fn encode_storage_key(key: &Self::KEY) -> Vec<u8>  { ... }
    fn hex_encode_storage_key(key: &Self::KEY) -> String { ... }
    fn decode_hex_storage_key(value: &str) -> Result<Self::KEY, Error> { ... }
    fn decode_storage_key(value: &mut &[u8]) -> Result<Self::KEY, Error> { ... }
    fn decode_hex_storage_value(value: &str) -> Result<Self::VALUE, Error> { ... }
    fn decode_storage_value(value: &mut &[u8]) -> Result<Self::VALUE, Error> { ... }
    fn fetch(
        client: &RpcClient,
        key: &Self::KEY,
        at: Option<H256>,
    ) -> impl Future<Output = Result<Option<Self::VALUE>, Error>> { ... }
    fn iter(client: RpcClient, block_hash: H256) -> StorageMapIterator<Self>
       where Self: Sized { ... }
}

Required Associated Constants§

Required Associated Types§

Provided Methods§

Source

fn encode_partial_key() -> [u8; 32]

Source

fn hex_encode_partial_key() -> String

Source

fn encode_storage_key(key: &Self::KEY) -> Vec<u8>

Source

fn hex_encode_storage_key(key: &Self::KEY) -> String

Source

fn decode_hex_storage_key(value: &str) -> Result<Self::KEY, Error>

Decodes the Hex and SCALE encoded Storage Key This is equal to Hex::decode + Self::decode_storage_key

If you need to decode bytes call decode_storage_key

Source

fn decode_storage_key(value: &mut &[u8]) -> Result<Self::KEY, Error>

Decodes the SCALE encoded Storage Key

If you need to decode Hex string call decode_hex_storage_key

Source

fn decode_hex_storage_value(value: &str) -> Result<Self::VALUE, Error>

Decodes the Hex and SCALE encoded Storage Value This is equal to Hex::decode + Self::decode_storage_value

If you need to decode bytes call decode_storage_value

Source

fn decode_storage_value(value: &mut &[u8]) -> Result<Self::VALUE, Error>

Decodes the SCALE encoded Storage Value

If you need to decode Hex string call decode_hex_storage_value

Source

fn fetch( client: &RpcClient, key: &Self::KEY, at: Option<H256>, ) -> impl Future<Output = Result<Option<Self::VALUE>, Error>>

Fetches and decodes a Storage Value

Returns None if no Storage Value is present

Source

fn iter(client: RpcClient, block_hash: H256) -> StorageMapIterator<Self>
where Self: Sized,

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§

Source§

impl StorageMap for AppKeys

Source§

const KEY_HASHER: StorageHasher = StorageHasher::Blake2_128Concat

Source§

const PALLET_NAME: &'static str = "DataAvailability"

Source§

const STORAGE_NAME: &'static str = "AppKeys"

Source§

type KEY = Vec<u8>

Source§

type VALUE = AppKey

Source§

impl StorageMap for SetIdSession

Source§

const KEY_HASHER: StorageHasher = StorageHasher::Twox64Concat

Source§

const PALLET_NAME: &'static str = "Grandpa"

Source§

const STORAGE_NAME: &'static str = "SetIdSession"

Source§

type KEY = u64

Source§

type VALUE = u32

Source§

impl StorageMap for Account

Source§

const KEY_HASHER: StorageHasher = StorageHasher::Blake2_128Concat

Source§

const PALLET_NAME: &'static str = "System"

Source§

const STORAGE_NAME: &'static str = "Account"

Source§

type KEY = AccountId32

Source§

type VALUE = AccountInfo