Skip to main content

Decode

Trait Decode 

Source
pub trait Decode: Sized {
    // Required methods
    fn is_ssz_fixed_len() -> bool;
    fn from_ssz_bytes(bytes: &[u8]) -> Result<Self, DecodeError>;

    // Provided method
    fn ssz_fixed_len() -> usize { ... }
}
Expand description

SSZ decoding trait.

Required Methods§

Source

fn is_ssz_fixed_len() -> bool

true iff this type is fixed-length.

Source

fn from_ssz_bytes(bytes: &[u8]) -> Result<Self, DecodeError>

Decode a full instance from bytes, rejecting trailing input.

Provided Methods§

Source

fn ssz_fixed_len() -> usize

Number of bytes this type occupies in the fixed-length portion of a container encoding. Variable-length types return BYTES_PER_LENGTH_OFFSET.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Decode for bool

Source§

impl Decode for u8

Source§

impl Decode for u16

Source§

impl Decode for u32

Source§

impl Decode for u64

Source§

impl Decode for u128

Source§

impl Decode for NonZeroU32

Source§

impl<A: Decode, B: Decode> Decode for (A, B)

Source§

impl<K: Decode + Ord, V: Decode> Decode for BTreeMap<K, V>

Source§

impl<T: Decode> Decode for Option<T>

Source§

impl<T: Decode> Decode for Vec<T>

Source§

impl<const N: usize> Decode for [u8; N]

Source§

impl<const N: usize> Decode for [u64; N]

Implementors§

Source§

impl Decode for U256

Source§

impl<T: Decode> Decode for MissingOr<T>

Source§

impl<T: Decode, const N: u64> Decode for List<T, N>

Source§

impl<T: Decode, const N: u64> Decode for SparseList<T, N>

Source§

impl<T: Decode, const N: usize> Decode for FixedVector<T, N>

Source§

impl<const N: u64> Decode for Bitlist<N>

Source§

impl<const N: usize> Decode for Bitvector<N>