pub trait StorageAddress {
    type Target: DecodeWithMetadata;
    type IsFetchable;
    type IsDefaultable;
    type IsIterable;

    // Required methods
    fn pallet_name(&self) -> &str;
    fn entry_name(&self) -> &str;
    fn append_entry_bytes(
        &self,
        metadata: &Metadata,
        bytes: &mut Vec<u8>
    ) -> Result<(), Error>;

    // Provided method
    fn validation_hash(&self) -> Option<[u8; 32]> { ... }
}
Expand description

This represents a storage address. Anything implementing this trait can be used to fetch and iterate over storage entries.

Required Associated Types§

source

type Target: DecodeWithMetadata

The target type of the value that lives at this address.

source

type IsFetchable

Can an entry be fetched from this address? Set this type to Yes to enable the corresponding calls to be made.

source

type IsDefaultable

Can a default entry be obtained from this address? Set this type to Yes to enable the corresponding calls to be made.

source

type IsIterable

Can this address be iterated over? Set this type to Yes to enable the corresponding calls to be made.

Required Methods§

source

fn pallet_name(&self) -> &str

The name of the pallet that the entry lives under.

source

fn entry_name(&self) -> &str

The name of the entry in a given pallet that the item is at.

source

fn append_entry_bytes( &self, metadata: &Metadata, bytes: &mut Vec<u8> ) -> Result<(), Error>

Output the non-prefix bytes; that is, any additional bytes that need to be appended to the key to dig into maps.

Provided Methods§

source

fn validation_hash(&self) -> Option<[u8; 32]>

An optional hash which, if present, will be checked against the node metadata to confirm that the return type matches what we are expecting.

Implementors§

source§

impl<'a, Encodable> StorageAddress for DynamicStorageAddress<'a, Encodable>where Encodable: EncodeWithMetadata,

source§

impl<ReturnTy, Fetchable, Defaultable, Iterable> StorageAddress for StaticStorageAddress<ReturnTy, Fetchable, Defaultable, Iterable>where ReturnTy: DecodeWithMetadata,

§

type Target = ReturnTy

§

type IsDefaultable = Defaultable

§

type IsIterable = Iterable

§

type IsFetchable = Fetchable