Struct frame_support::traits::StorageVersion
source · pub struct StorageVersion(_);
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.
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>
§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,
§fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
fn skip<I>(input: &mut I) -> Result<(), Error>where I: Input,
§fn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
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 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<R, F: FnOnce(&[u8]) -> R>(&self, f: F) -> R
fn using_encoded<R, F: FnOnce(&[u8]) -> R>(&self, f: F) -> R
§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<StorageVersion> for StorageVersion
impl PartialEq<StorageVersion> for StorageVersion
source§fn eq(&self, other: &StorageVersion) -> bool
fn eq(&self, other: &StorageVersion) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<u16> for StorageVersion
impl PartialEq<u16> for StorageVersion
source§impl PartialOrd<StorageVersion> for StorageVersion
impl PartialOrd<StorageVersion> for StorageVersion
source§fn partial_cmp(&self, other: &StorageVersion) -> Option<Ordering>
fn partial_cmp(&self, other: &StorageVersion) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<u16> for StorageVersion
impl PartialOrd<u16> for StorageVersion
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<T: GetStorageVersion<CurrentStorageVersion = StorageVersion> + PalletInfoAccess> StoreCurrentStorageVersion<T> for StorageVersion
impl<T: GetStorageVersion<CurrentStorageVersion = StorageVersion> + PalletInfoAccess> StoreCurrentStorageVersion<T> for StorageVersion
source§fn store_current_storage_version()
fn store_current_storage_version()
impl Copy for StorageVersion
impl EncodeLike<StorageVersion> for StorageVersion
impl Eq for StorageVersion
impl StructuralEq for StorageVersion
impl StructuralPartialEq for StorageVersion
Auto Trait Implementations§
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> CheckedConversion for T
impl<T> CheckedConversion for T
§impl<T> DecodeAll for Twhere
T: Decode,
impl<T> DecodeAll for Twhere T: Decode,
§fn decode_all(input: &mut &[u8]) -> Result<T, Error>
fn decode_all(input: &mut &[u8]) -> Result<T, Error>
Self
and consume all of the given input data. Read more§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere T: Decode,
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
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, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,
§impl<T> Pointable for T
impl<T> Pointable 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<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 Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.