pub struct StorageInfo<'info, TypeId: Clone> {
pub keys: Cow<'info, [StorageKeyInfo<TypeId>]>,
pub value_id: TypeId,
pub default_value: Option<Cow<'info, [u8]>>,
pub use_old_v9_storage_hashers: bool,
}Expand description
Information about a storage entry.
Fields§
§keys: Cow<'info, [StorageKeyInfo<TypeId>]>No entries if a plain storage entry, or N entries for N maps.
value_id: TypeIdThe type of the values.
default_value: Option<Cow<'info, [u8]>>Bytes representing the default value for this entry, if one exists.
use_old_v9_storage_hashers: boolAre we using V9 metadata prior to a change which added a new storage hasher?
See https://github.com/paritytech/substrate/commit/bbb363f4320b4a72e059c0fca96af42296d5a6bf#diff-aa7bc120d701816def0f2a5eb469212d2b7021d2fc9d3b284f843f3f8089e91a
Here a new hasher is added in the middle of the hashers enum. Thus, Metadata produced
by V9 runtimes prior to this change will not correctly decode into frame-metadata’s V9
which includes the change.
On Kusama for instance, this should be set to true when using metadata from any spec version below 1032 in order to enable decoding correctly from it.
Implementations§
Source§impl<'info, TypeId: Clone + 'static> StorageInfo<'info, TypeId>
impl<'info, TypeId: Clone + 'static> StorageInfo<'info, TypeId>
Sourcepub fn use_use_old_v9_storage_hashers(self, b: bool) -> Self
pub fn use_use_old_v9_storage_hashers(self, b: bool) -> Self
For older V9 metadatas, this needs toggling. See the docs on StorageInfo::use_old_v9_storage_hashers.
Sourcepub fn into_owned(self) -> StorageInfo<'static, TypeId>
pub fn into_owned(self) -> StorageInfo<'static, TypeId>
Take ownership of this StorageInfo, turning any lifetimes to 'static.
Sourcepub fn map_ids<NewTypeId: Clone, E, F: FnMut(TypeId) -> Result<NewTypeId, E>>(
self,
f: F,
) -> Result<StorageInfo<'static, NewTypeId>, E>
pub fn map_ids<NewTypeId: Clone, E, F: FnMut(TypeId) -> Result<NewTypeId, E>>( self, f: F, ) -> Result<StorageInfo<'static, NewTypeId>, E>
Map the type IDs in this StorageInfo, returning a new one or bailing early with an error if something goes wrong.
This also takes ownership of the StorageInfo, turning the lifetime to static.
Trait Implementations§
Source§impl<'info, TypeId: Clone + Clone> Clone for StorageInfo<'info, TypeId>
impl<'info, TypeId: Clone + Clone> Clone for StorageInfo<'info, TypeId>
Source§fn clone(&self) -> StorageInfo<'info, TypeId>
fn clone(&self) -> StorageInfo<'info, TypeId>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<'info, TypeId: Eq + Clone> Eq for StorageInfo<'info, TypeId>
impl<'info, TypeId: Clone> StructuralPartialEq for StorageInfo<'info, TypeId>
Auto Trait Implementations§
impl<'info, TypeId> Freeze for StorageInfo<'info, TypeId>where
TypeId: Freeze,
impl<'info, TypeId> RefUnwindSafe for StorageInfo<'info, TypeId>where
TypeId: RefUnwindSafe,
impl<'info, TypeId> Send for StorageInfo<'info, TypeId>
impl<'info, TypeId> Sync for StorageInfo<'info, TypeId>where
TypeId: Sync,
impl<'info, TypeId> Unpin for StorageInfo<'info, TypeId>where
TypeId: Unpin,
impl<'info, TypeId> UnwindSafe for StorageInfo<'info, TypeId>where
TypeId: UnwindSafe + RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more