Trait ssz::Decode[][src]

pub trait Decode: Sized {
    fn is_ssz_fixed_len() -> bool;
fn from_ssz_bytes(bytes: &[u8]) -> Result<Self, DecodeError>; fn ssz_fixed_len() -> usize { ... } }
Expand description

Provides SSZ decoding (de-serialization) via the from_ssz_bytes(&bytes) method.

See examples/ for manual implementations or the crate root for implementations using #[derive(Decode)].

Required methods

Returns true if this object has a fixed-length.

I.e., there are no variable length items in this object or any of it’s contained objects.

Attempts to decode Self from bytes, returning a DecodeError on failure.

The supplied bytes must be the exact length required to decode Self, excess bytes will result in an error.

Provided methods

The number of bytes this object occupies in the fixed-length portion of the SSZ bytes.

By default, this is set to BYTES_PER_LENGTH_OFFSET which is suitable for variable length objects, but not fixed-length objects. Fixed-length objects must return a value which represents their length.

Implementations on Foreign Types

Implementors