Struct parity_scale_codec::Compact
source · 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: T
Trait 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>(_input: &mut I) -> Result<Self, Error>
fn decode<I: Input>(_input: &mut I) -> Result<Self, Error>
Attempt to deserialise the value from input.
source§fn decode_into<I: Input>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>
fn decode_into<I: Input>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
source§impl<T> Decode for Compact<T>where
T: CompactAs,
Compact<T::As>: Decode,
impl<T> Decode for Compact<T>where
T: CompactAs,
Compact<T::As>: Decode,
source§fn decode<I: Input>(input: &mut I) -> Result<Self, Error>
fn decode<I: Input>(input: &mut I) -> Result<Self, Error>
Attempt to deserialise the value from input.
source§fn decode_into<I: Input>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>
fn decode_into<I: Input>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>
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>(input: &mut I) -> Result<Self, Error>
fn decode<I: Input>(input: &mut I) -> Result<Self, Error>
Attempt to deserialise the value from input.
source§fn decode_into<I: Input>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>
fn decode_into<I: Input>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>
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>(input: &mut I) -> Result<Self, Error>
fn decode<I: Input>(input: &mut I) -> Result<Self, Error>
Attempt to deserialise the value from input.
source§fn decode_into<I: Input>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>
fn decode_into<I: Input>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>
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>(input: &mut I) -> Result<Self, Error>
fn decode<I: Input>(input: &mut I) -> Result<Self, Error>
Attempt to deserialise the value from input.
source§fn decode_into<I: Input>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>
fn decode_into<I: Input>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>
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>(input: &mut I) -> Result<Self, Error>
fn decode<I: Input>(input: &mut I) -> Result<Self, Error>
Attempt to deserialise the value from input.
source§fn decode_into<I: Input>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>
fn decode_into<I: Input>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>
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>(input: &mut I) -> Result<Self, Error>
fn decode<I: Input>(input: &mut I) -> Result<Self, Error>
Attempt to deserialise the value from input.
source§fn decode_into<I: Input>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>
fn decode_into<I: Input>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>
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>,
impl<'de, T> Deserialize<'de> for Compact<T>where
T: Deserialize<'de>,
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<T> Encode for Compact<T>where
for<'a> CompactRef<'a, T>: Encode,
impl<T> Encode for Compact<T>where
for<'a> CompactRef<'a, T>: 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: Output + ?Sized>(&self, dest: &mut W)
fn encode_to<W: Output + ?Sized>(&self, dest: &mut W)
Convert self to a slice and append it to the destination.
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
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: 'a> EncodeAsRef<'a, T> for Compact<T>where
CompactRef<'a, T>: Encode + From<&'a T>,
impl<'a, T: 'a> EncodeAsRef<'a, T> for Compact<T>where
CompactRef<'a, T>: Encode + From<&'a T>,
§type RefType = CompactRef<'a, T>
type RefType = CompactRef<'a, T>
The reference type that is used for encoding.
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> Ord for Compact<T>
impl<T: Ord> Ord for Compact<T>
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<T: PartialEq> PartialEq<Compact<T>> for Compact<T>
impl<T: PartialEq> PartialEq<Compact<T>> for Compact<T>
source§impl<T: PartialOrd> PartialOrd<Compact<T>> for Compact<T>
impl<T: PartialOrd> PartialOrd<Compact<T>> for Compact<T>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more