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
sourceimpl CompactLen<u128> for Compact<u128>
impl CompactLen<u128> for Compact<u128>
sourcefn compact_len(val: &u128) -> usize
fn compact_len(val: &u128) -> usize
Returns the compact encoded length for the given value.
sourceimpl CompactLen<u16> for Compact<u16>
impl CompactLen<u16> for Compact<u16>
sourcefn compact_len(val: &u16) -> usize
fn compact_len(val: &u16) -> usize
Returns the compact encoded length for the given value.
sourceimpl CompactLen<u32> for Compact<u32>
impl CompactLen<u32> for Compact<u32>
sourcefn compact_len(val: &u32) -> usize
fn compact_len(val: &u32) -> usize
Returns the compact encoded length for the given value.
sourceimpl CompactLen<u64> for Compact<u64>
impl CompactLen<u64> for Compact<u64>
sourcefn compact_len(val: &u64) -> usize
fn compact_len(val: &u64) -> usize
Returns the compact encoded length for the given value.
sourceimpl CompactLen<u8> for Compact<u8>
impl CompactLen<u8> for Compact<u8>
sourcefn compact_len(val: &u8) -> usize
fn compact_len(val: &u8) -> usize
Returns the compact encoded length for the given value.
sourceimpl<'de, T> Deserialize<'de> for Compact<T> where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Compact<T> where
T: Deserialize<'de>,
sourcefn 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
sourceimpl<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,
sourcefn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
sourcefn encode_to<W: Output>(&self, dest: &mut W)
fn encode_to<W: Output>(&self, dest: &mut W)
Convert self to a slice and append it to the destination.
sourceimpl<'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.
sourceimpl<T: Ord> Ord for Compact<T>
impl<T: Ord> Ord for Compact<T>
sourceimpl<T: PartialOrd> PartialOrd<Compact<T>> for Compact<T>
impl<T: PartialOrd> PartialOrd<Compact<T>> for Compact<T>
sourcefn partial_cmp(&self, other: &Compact<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &Compact<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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
impl<T: Copy> Copy for Compact<T>
impl<T> EncodeLike<Compact<T>> for Compact<T> where
for<'a> CompactRef<'a, T>: Encode,
impl<T: Eq> Eq for Compact<T>
impl<T> StructuralEq for Compact<T>
impl<T> StructuralPartialEq for Compact<T>
Auto Trait Implementations
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> UnwindSafe for Compact<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more