pub struct Compact<T>(pub T);Expand description
Compact-encoded variant of T. This is more space-efficient but less compute-efficient.
Tuple Fields§
§0: TTrait Implementations§
Source§impl CompactLen<u128> for Compact<u128>
impl CompactLen<u128> for Compact<u128>
Source§fn compact_len(val: &u128) -> usize
fn compact_len(val: &u128) -> usize
Returns the compact encoded length for the given value.
Source§impl CompactLen<u16> for Compact<u16>
impl CompactLen<u16> for Compact<u16>
Source§fn compact_len(val: &u16) -> usize
fn compact_len(val: &u16) -> usize
Returns the compact encoded length for the given value.
Source§impl CompactLen<u32> for Compact<u32>
impl CompactLen<u32> for Compact<u32>
Source§fn compact_len(val: &u32) -> usize
fn compact_len(val: &u32) -> usize
Returns the compact encoded length for the given value.
Source§impl CompactLen<u64> for Compact<u64>
impl CompactLen<u64> for Compact<u64>
Source§fn compact_len(val: &u64) -> usize
fn compact_len(val: &u64) -> usize
Returns the compact encoded length for the given value.
Source§impl CompactLen<u8> for Compact<u8>
impl CompactLen<u8> for Compact<u8>
Source§fn compact_len(val: &u8) -> usize
fn compact_len(val: &u8) -> usize
Returns the compact encoded length for the given value.
Source§impl Decode for Compact<()>
impl Decode for Compact<()>
Source§fn decode<I>(_input: &mut I) -> Result<Compact<()>, Error>where
I: Input,
fn decode<I>(_input: &mut I) -> Result<Compact<()>, Error>where
I: Input,
Attempt to deserialise the value from input.
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,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
Source§impl<T> Decode for Compact<T>
impl<T> Decode for Compact<T>
Source§fn decode<I>(input: &mut I) -> Result<Compact<T>, Error>where
I: Input,
fn decode<I>(input: &mut I) -> Result<Compact<T>, Error>where
I: Input,
Attempt to deserialise the value from input.
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,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
Source§impl Decode for Compact<u128>
impl Decode for Compact<u128>
Source§fn decode<I>(input: &mut I) -> Result<Compact<u128>, Error>where
I: Input,
fn decode<I>(input: &mut I) -> Result<Compact<u128>, Error>where
I: Input,
Attempt to deserialise the value from input.
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,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
Source§impl Decode for Compact<u16>
impl Decode for Compact<u16>
Source§fn decode<I>(input: &mut I) -> Result<Compact<u16>, Error>where
I: Input,
fn decode<I>(input: &mut I) -> Result<Compact<u16>, Error>where
I: Input,
Attempt to deserialise the value from input.
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,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
Source§impl Decode for Compact<u32>
impl Decode for Compact<u32>
Source§fn decode<I>(input: &mut I) -> Result<Compact<u32>, Error>where
I: Input,
fn decode<I>(input: &mut I) -> Result<Compact<u32>, Error>where
I: Input,
Attempt to deserialise the value from input.
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,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
Source§impl Decode for Compact<u64>
impl Decode for Compact<u64>
Source§fn decode<I>(input: &mut I) -> Result<Compact<u64>, Error>where
I: Input,
fn decode<I>(input: &mut I) -> Result<Compact<u64>, Error>where
I: Input,
Attempt to deserialise the value from input.
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,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
Source§impl Decode for Compact<u8>
impl Decode for Compact<u8>
Source§fn decode<I>(input: &mut I) -> Result<Compact<u8>, Error>where
I: Input,
fn decode<I>(input: &mut I) -> Result<Compact<u8>, Error>where
I: Input,
Attempt to deserialise the value from input.
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,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
Source§impl<'de, T> Deserialize<'de> for Compact<T>where
T: Deserialize<'de>,
Available on crate feature serde only.
impl<'de, T> Deserialize<'de> for Compact<T>where
T: Deserialize<'de>,
Available on crate feature
serde only.Source§fn deserialize<D>(
deserializer: D,
) -> Result<Compact<T>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Compact<T>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T> Encode for Compact<T>where
CompactRef<'a, T>: for<'a> Encode,
impl<T> Encode for Compact<T>where
CompactRef<'a, T>: for<'a> Encode,
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
Source§fn encode_to<W>(&self, dest: &mut W)
fn encode_to<W>(&self, dest: &mut W)
Convert self to a slice and append it to the destination.
Source§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
Convert self to a slice and then invoke the given closure with it.
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
Source§impl<'a, T> EncodeAsRef<'a, T> for Compact<T>
impl<'a, T> EncodeAsRef<'a, T> for Compact<T>
Source§type RefType = CompactRef<'a, T>
type RefType = CompactRef<'a, T>
The reference type that is used for encoding.
Source§impl From<Compact<Perquintill>> for Perquintill
impl From<Compact<Perquintill>> for Perquintill
Source§fn from(x: Compact<Perquintill>) -> Perquintill
fn from(x: Compact<Perquintill>) -> Perquintill
Converts to this type from the input type.
Source§impl<T, D> From<Compact<TypeWithDefault<T, D>>> for TypeWithDefault<T, D>where
D: Get<T>,
impl<T, D> From<Compact<TypeWithDefault<T, D>>> for TypeWithDefault<T, D>where
D: Get<T>,
Source§fn from(c: Compact<TypeWithDefault<T, D>>) -> TypeWithDefault<T, D>
fn from(c: Compact<TypeWithDefault<T, D>>) -> TypeWithDefault<T, D>
Converts to this type from the input type.
Source§impl MaxEncodedLen for Compact<()>
impl MaxEncodedLen for Compact<()>
Source§fn max_encoded_len() -> usize
fn max_encoded_len() -> usize
Upper bound, in bytes, of the maximum encoded size of this item.
Source§impl MaxEncodedLen for Compact<u128>
impl MaxEncodedLen for Compact<u128>
Source§fn max_encoded_len() -> usize
fn max_encoded_len() -> usize
Upper bound, in bytes, of the maximum encoded size of this item.
Source§impl MaxEncodedLen for Compact<u16>
impl MaxEncodedLen for Compact<u16>
Source§fn max_encoded_len() -> usize
fn max_encoded_len() -> usize
Upper bound, in bytes, of the maximum encoded size of this item.
Source§impl MaxEncodedLen for Compact<u32>
impl MaxEncodedLen for Compact<u32>
Source§fn max_encoded_len() -> usize
fn max_encoded_len() -> usize
Upper bound, in bytes, of the maximum encoded size of this item.
Source§impl MaxEncodedLen for Compact<u64>
impl MaxEncodedLen for Compact<u64>
Source§fn max_encoded_len() -> usize
fn max_encoded_len() -> usize
Upper bound, in bytes, of the maximum encoded size of this item.
Source§impl MaxEncodedLen for Compact<u8>
impl MaxEncodedLen for Compact<u8>
Source§fn max_encoded_len() -> usize
fn max_encoded_len() -> usize
Upper bound, in bytes, of the maximum encoded size of this item.
Source§impl<T> Ord for Compact<T>where
T: Ord,
impl<T> Ord for Compact<T>where
T: Ord,
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PalletError for Compact<u128>
impl PalletError for Compact<u128>
Source§const MAX_ENCODED_SIZE: usize = 17
const MAX_ENCODED_SIZE: usize = 17
The maximum encoded size for the implementing type. Read more
Source§impl PalletError for Compact<u16>
impl PalletError for Compact<u16>
Source§const MAX_ENCODED_SIZE: usize = 4
const MAX_ENCODED_SIZE: usize = 4
The maximum encoded size for the implementing type. Read more
Source§impl PalletError for Compact<u32>
impl PalletError for Compact<u32>
Source§const MAX_ENCODED_SIZE: usize = 5
const MAX_ENCODED_SIZE: usize = 5
The maximum encoded size for the implementing type. Read more
Source§impl PalletError for Compact<u64>
impl PalletError for Compact<u64>
Source§const MAX_ENCODED_SIZE: usize = 9
const MAX_ENCODED_SIZE: usize = 9
The maximum encoded size for the implementing type. Read more
Source§impl PalletError for Compact<u8>
impl PalletError for Compact<u8>
Source§const MAX_ENCODED_SIZE: usize = 2
const MAX_ENCODED_SIZE: usize = 2
The maximum encoded size for the implementing type. Read more
Source§impl<T> PartialOrd for Compact<T>where
T: PartialOrd,
impl<T> PartialOrd for Compact<T>where
T: PartialOrd,
Source§impl<T> Serialize for Compact<T>where
T: Serialize,
Available on crate feature serde only.
impl<T> Serialize for Compact<T>where
T: Serialize,
Available on crate feature
serde only.Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<T> Copy for Compact<T>where
T: Copy,
impl DecodeWithMemTracking for Compact<()>
impl<T> DecodeWithMemTracking for Compact<T>
impl DecodeWithMemTracking for Compact<u128>
impl DecodeWithMemTracking for Compact<u16>
impl DecodeWithMemTracking for Compact<u32>
impl DecodeWithMemTracking for Compact<u64>
impl DecodeWithMemTracking for Compact<u8>
impl<T> EncodeLike for Compact<T>where
CompactRef<'a, T>: for<'a> Encode,
impl<T> Eq for Compact<T>where
T: Eq,
impl<T> StructuralPartialEq for Compact<T>
Auto Trait Implementations§
impl<T> Freeze for Compact<T>where
T: Freeze,
impl<T> RefUnwindSafe for Compact<T>where
T: RefUnwindSafe,
impl<T> Send for Compact<T>where
T: Send,
impl<T> Sync for Compact<T>where
T: Sync,
impl<T> Unpin for Compact<T>where
T: Unpin,
impl<T> UnsafeUnpin for Compact<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Compact<T>where
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
Source§impl<T> DecodeWithMemLimit for Twhere
T: DecodeWithMemTracking,
impl<T> DecodeWithMemLimit for Twhere
T: DecodeWithMemTracking,
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<T, U> DefensiveTruncateInto<U> for Twhere
U: DefensiveTruncateFrom<T>,
impl<T, U> DefensiveTruncateInto<U> for Twhere
U: DefensiveTruncateFrom<T>,
Source§fn defensive_truncate_into(self) -> U
fn defensive_truncate_into(self) -> U
Defensively truncate a value and convert it into its bounded form.
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
Compare self to
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> 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> ⓘ
Converts
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> ⓘ
Converts
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>,
Consume self to return an equivalent value of
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
The counterpart to
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
Consume self to return an equivalent value of
T.