pub struct StorageVersion(/* private fields */);
Expand description
The storage version of a pallet.
Each storage version of a pallet is stored in the state under a fixed key. See
STORAGE_VERSION_STORAGE_KEY_POSTFIX
for how this key is built.
Implementations§
Source§impl StorageVersion
impl StorageVersion
Sourcepub fn storage_key<P: PalletInfoAccess>() -> [u8; 32]
pub fn storage_key<P: PalletInfoAccess>() -> [u8; 32]
Returns the storage key for a storage version.
See STORAGE_VERSION_STORAGE_KEY_POSTFIX
on how this key is built.
Sourcepub fn put<P: PalletInfoAccess>(&self)
pub fn put<P: PalletInfoAccess>(&self)
Put this storage version for the given pallet into the storage.
It will use the storage key that is associated with the given Pallet
.
§Panics
This function will panic iff Pallet
can not be found by PalletInfo
.
In a runtime that is put together using
construct_runtime!
this should never happen.
It will also panic if this function isn’t executed in an externalities provided environment.
Sourcepub fn get<P: PalletInfoAccess>() -> Self
pub fn get<P: PalletInfoAccess>() -> Self
Get the storage version of the given pallet from the storage.
It will use the storage key that is associated with the given Pallet
.
§Panics
This function will panic iff Pallet
can not be found by PalletInfo
.
In a runtime that is put together using
construct_runtime!
this should never happen.
It will also panic if this function isn’t executed in an externalities provided environment.
Sourcepub fn exists<P: PalletInfoAccess>() -> bool
pub fn exists<P: PalletInfoAccess>() -> bool
Returns if the storage version key for the given pallet exists in storage.
See STORAGE_VERSION_STORAGE_KEY_POSTFIX
on how this key is built.
§Panics
This function will panic iff Pallet
can not be found by PalletInfo
.
In a runtime that is put together using
construct_runtime!
this should never happen.
It will also panic if this function isn’t executed in an externalities provided environment.
Trait Implementations§
Source§impl Add<u16> for StorageVersion
impl Add<u16> for StorageVersion
Source§impl Clone for StorageVersion
impl Clone for StorageVersion
Source§fn clone(&self) -> StorageVersion
fn clone(&self) -> StorageVersion
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for StorageVersion
impl Debug for StorageVersion
Source§impl Decode for StorageVersion
impl Decode for StorageVersion
Source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<Self, Error>
Source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
Source§impl Default for StorageVersion
impl Default for StorageVersion
Source§fn default() -> StorageVersion
fn default() -> StorageVersion
Source§impl Encode for StorageVersion
impl Encode for StorageVersion
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
Source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Source§fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback: FnOnce(&[u8]) -> __CodecOutputReturn>(
&self,
f: __CodecUsingEncodedCallback,
) -> __CodecOutputReturn
fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback: FnOnce(&[u8]) -> __CodecOutputReturn>( &self, f: __CodecUsingEncodedCallback, ) -> __CodecOutputReturn
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Source§impl Ord for StorageVersion
impl Ord for StorageVersion
Source§fn cmp(&self, other: &StorageVersion) -> Ordering
fn cmp(&self, other: &StorageVersion) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq<u16> for StorageVersion
impl PartialEq<u16> for StorageVersion
Source§impl PartialEq for StorageVersion
impl PartialEq for StorageVersion
Source§impl PartialOrd<u16> for StorageVersion
impl PartialOrd<u16> for StorageVersion
Source§impl PartialOrd for StorageVersion
impl PartialOrd for StorageVersion
Source§impl<T: GetStorageVersion<InCodeStorageVersion = StorageVersion> + PalletInfoAccess> StoreInCodeStorageVersion<T> for StorageVersion
impl<T: GetStorageVersion<InCodeStorageVersion = StorageVersion> + PalletInfoAccess> StoreInCodeStorageVersion<T> for StorageVersion
Source§fn store_in_code_storage_version()
fn store_in_code_storage_version()
impl Copy for StorageVersion
impl EncodeLike for StorageVersion
impl Eq for StorageVersion
impl StructuralPartialEq for StorageVersion
Auto Trait Implementations§
impl Freeze for StorageVersion
impl RefUnwindSafe for StorageVersion
impl Send for StorageVersion
impl Sync for StorageVersion
impl Unpin for StorageVersion
impl UnwindSafe for StorageVersion
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> CheckedConversion for T
impl<T> CheckedConversion for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
Source§impl<T> DefensiveMax<T> for Twhere
T: PartialOrd,
impl<T> DefensiveMax<T> for Twhere
T: PartialOrd,
Source§fn defensive_max(self, other: T) -> T
fn defensive_max(self, other: T) -> T
Source§fn defensive_strict_max(self, other: T) -> T
fn defensive_strict_max(self, other: T) -> T
Source§impl<T> DefensiveMin<T> for Twhere
T: PartialOrd,
impl<T> DefensiveMin<T> for Twhere
T: PartialOrd,
Source§fn defensive_min(self, other: T) -> T
fn defensive_min(self, other: T) -> T
Source§fn defensive_strict_min(self, other: T) -> T
fn defensive_strict_min(self, other: T) -> T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
fn into_tuple(self) -> Dest
Source§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
Source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
Source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
Source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T
. Read moreSource§impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
type Error = <U as TryFromKey<T>>::Error
fn try_into_key(self) -> Result<U, <U as TryFromKey<T>>::Error>
Source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.Source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.