pub trait StorageKey {
// Required methods
fn encode_storage_key(
&self,
bytes: &mut Vec<u8>,
hashers: &mut StorageHashersIter<'_>,
types: &PortableRegistry,
) -> Result<(), Error>;
fn decode_storage_key(
bytes: &mut &[u8],
hashers: &mut StorageHashersIter<'_>,
types: &PortableRegistry,
) -> Result<Self, Error>
where Self: Sized + 'static;
}Expand description
This trait should be implemented by anything that can be used as one or multiple storage keys.
Required Methods§
Sourcefn encode_storage_key(
&self,
bytes: &mut Vec<u8>,
hashers: &mut StorageHashersIter<'_>,
types: &PortableRegistry,
) -> Result<(), Error>
fn encode_storage_key( &self, bytes: &mut Vec<u8>, hashers: &mut StorageHashersIter<'_>, types: &PortableRegistry, ) -> Result<(), Error>
Encodes the storage key into some bytes
Sourcefn decode_storage_key(
bytes: &mut &[u8],
hashers: &mut StorageHashersIter<'_>,
types: &PortableRegistry,
) -> Result<Self, Error>where
Self: Sized + 'static,
fn decode_storage_key(
bytes: &mut &[u8],
hashers: &mut StorageHashersIter<'_>,
types: &PortableRegistry,
) -> Result<Self, Error>where
Self: Sized + 'static,
Attempts to decode the StorageKey given some bytes and a set of hashers and type IDs that they are meant to represent.
The bytes passed to decode should start with:
-
- some fixed size hash (for all hashers except
Identity)
- some fixed size hash (for all hashers except
-
- the plain key value itself (for
Identity,Blake2_128ConcatandTwox64Concathashers)
- the plain key value itself (for
Implementations on Foreign Types§
Source§impl StorageKey for ()
Implement StorageKey for () which can be used for keyless storage entries,
or to otherwise just ignore some entry.
impl StorageKey for ()
Implement StorageKey for () which can be used for keyless storage entries,
or to otherwise just ignore some entry.