StorageInstance

Trait StorageInstance 

Source
pub trait StorageInstance {
    const STORAGE_PREFIX: &'static str;

    // Required method
    fn pezpallet_prefix() -> &'static str;

    // Provided methods
    fn pezpallet_prefix_hash() -> [u8; 16] { ... }
    fn storage_prefix_hash() -> [u8; 16] { ... }
    fn prefix_hash() -> [u8; 32] { ... }
}
Expand description

An instance of a storage in a pezpallet.

Define an instance for an individual storage inside a pezpallet. The pezpallet prefix is used to isolate the storage between pallets, and the storage prefix is used to isolate storages inside a pezpallet.

NOTE: These information can be used to define storages in pezpallet such as a StorageMap which can use keys after twox_128(pezpallet_prefix())++twox_128(STORAGE_PREFIX)

Required Associated Constants§

Source

const STORAGE_PREFIX: &'static str

Prefix given to a storage to isolate from other storages in the pezpallet.

Required Methods§

Source

fn pezpallet_prefix() -> &'static str

Prefix of a pezpallet to isolate it from other pallets.

Provided Methods§

Source

fn pezpallet_prefix_hash() -> [u8; 16]

Return the prefix hash of pezpallet instance.

NOTE: This hash must be twox_128(pezpallet_prefix()). Should not impl this function by hand. Only use the default or macro generated impls.

Source

fn storage_prefix_hash() -> [u8; 16]

Return the prefix hash of storage instance.

NOTE: This hash must be twox_128(STORAGE_PREFIX).

Source

fn prefix_hash() -> [u8; 32]

Return the prefix hash of instance.

NOTE: This hash must be twox_128(pezpallet_prefix())++twox_128(STORAGE_PREFIX). Should not impl this function by hand. Only use the default or macro generated impls.

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§