Trait prio::codec::Decode

source ·
pub trait Decode: Sized {
    // Required method
    fn decode(bytes: &mut Cursor<&[u8]>) -> Result<Self, CodecError>;

    // Provided method
    fn get_decoded(bytes: &[u8]) -> Result<Self, CodecError> { ... }
}
Expand description

Describes how to decode an object from a byte sequence.

Required Methods§

source

fn decode(bytes: &mut Cursor<&[u8]>) -> Result<Self, CodecError>

Read and decode an encoded object from bytes. On success, the decoded value is returned and bytes is advanced by the encoded size of the value. On failure, an error is returned and no further attempt to read from bytes should be made.

Provided Methods§

source

fn get_decoded(bytes: &[u8]) -> Result<Self, CodecError>

Convenience method to get a decoded value. Returns an error if Self::decode fails, or if there are any bytes left in bytes after decoding a value.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Decode for u8

source§

fn decode(bytes: &mut Cursor<&[u8]>) -> Result<Self, CodecError>

source§

impl Decode for u16

source§

fn decode(bytes: &mut Cursor<&[u8]>) -> Result<Self, CodecError>

source§

impl Decode for u32

source§

fn decode(bytes: &mut Cursor<&[u8]>) -> Result<Self, CodecError>

source§

impl Decode for u64

source§

fn decode(bytes: &mut Cursor<&[u8]>) -> Result<Self, CodecError>

source§

impl Decode for ()

source§

fn decode(_bytes: &mut Cursor<&[u8]>) -> Result<Self, CodecError>

Implementors§

source§

impl Decode for PingPongMessage

source§

impl Decode for Field64

source§

impl Decode for Field128

source§

impl Decode for Field255

source§

impl Decode for FieldPrio2

source§

impl Decode for AggregateShare

Available on crate feature test-util only.
source§

impl Decode for AggregationParam

Available on crate feature test-util only.
source§

impl Decode for InputShare

Available on crate feature test-util only.
source§

impl Decode for OutputShare

Available on crate feature test-util only.
source§

impl Decode for PrepareState

Available on crate feature test-util only.
source§

impl Decode for Poplar1AggregationParam

Available on crate features crypto-dependencies and experimental only.
source§

impl<F> Decode for Poplar1IdpfValue<F>
where F: Decode,

Available on crate features crypto-dependencies and experimental only.
source§

impl<const SEED_SIZE: usize> Decode for Seed<SEED_SIZE>