Trait prio::codec::Encode

source ·
pub trait Encode {
    // Required method
    fn encode(&self, bytes: &mut Vec<u8>) -> Result<(), CodecError>;

    // Provided methods
    fn get_encoded(&self) -> Result<Vec<u8>, CodecError> { ... }
    fn encoded_len(&self) -> Option<usize> { ... }
}
Expand description

Describes how to encode objects into a byte sequence.

Required Methods§

source

fn encode(&self, bytes: &mut Vec<u8>) -> Result<(), CodecError>

Append the encoded form of this object to the end of bytes, growing the vector as needed.

Provided Methods§

source

fn get_encoded(&self) -> Result<Vec<u8>, CodecError>

Convenience method to encode a value into a new Vec<u8>.

source

fn encoded_len(&self) -> Option<usize>

Returns an optional hint indicating how many bytes will be required to encode this value, or None by default.

Implementations on Foreign Types§

source§

impl Encode for u8

source§

fn encode(&self, bytes: &mut Vec<u8>) -> Result<(), CodecError>

source§

fn encoded_len(&self) -> Option<usize>

source§

impl Encode for u16

source§

fn encode(&self, bytes: &mut Vec<u8>) -> Result<(), CodecError>

source§

fn encoded_len(&self) -> Option<usize>

source§

impl Encode for u32

source§

fn encode(&self, bytes: &mut Vec<u8>) -> Result<(), CodecError>

source§

fn encoded_len(&self) -> Option<usize>

source§

impl Encode for u64

source§

fn encode(&self, bytes: &mut Vec<u8>) -> Result<(), CodecError>

source§

fn encoded_len(&self) -> Option<usize>

source§

impl Encode for ()

source§

fn encode(&self, _bytes: &mut Vec<u8>) -> Result<(), CodecError>

source§

fn encoded_len(&self) -> Option<usize>

Implementors§

source§

impl Encode for PingPongMessage

source§

impl Encode for Poplar1FieldVec

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

impl Encode for Field64

source§

impl Encode for Field128

source§

impl Encode for Field255

source§

impl Encode for FieldPrio2

source§

impl Encode for prio::vdaf::dummy::AggregateShare

Available on crate feature test-util only.
source§

impl Encode for AggregationParam

Available on crate feature test-util only.
source§

impl Encode for InputShare

Available on crate feature test-util only.
source§

impl Encode for prio::vdaf::dummy::OutputShare

Available on crate feature test-util only.
source§

impl Encode for PrepareState

Available on crate feature test-util only.
source§

impl Encode for Poplar1AggregationParam

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

impl Encode for Poplar1PrepareMessage

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

impl Encode for Poplar1PrepareState

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

impl Encode for Prio2PrepareShare

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

impl Encode for Prio2PrepareState

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

impl<F> Encode for Poplar1IdpfValue<F>
where F: FieldElement,

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

impl<F: FftFriendlyFieldElement, const SEED_SIZE: usize> Encode for Prio3InputShare<F, SEED_SIZE>

source§

impl<F: FftFriendlyFieldElement, const SEED_SIZE: usize> Encode for Prio3PrepareShare<F, SEED_SIZE>

source§

impl<F: FftFriendlyFieldElement, const SEED_SIZE: usize> Encode for Prio3PrepareState<F, SEED_SIZE>

source§

impl<F: FieldElement> Encode for prio::vdaf::AggregateShare<F>

source§

impl<F: FieldElement> Encode for prio::vdaf::OutputShare<F>

source§

impl<F: FieldElement> Encode for VidpfWeight<F>

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

impl<F: FieldElement, const SEED_SIZE: usize> Encode for Share<F, SEED_SIZE>

source§

impl<VI, VL> Encode for IdpfPublicShare<VI, VL>
where VI: Encode, VL: Encode,

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

impl<const SEED_SIZE: usize> Encode for Poplar1InputShare<SEED_SIZE>

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

impl<const SEED_SIZE: usize> Encode for Prio3PrepareMessage<SEED_SIZE>

source§

impl<const SEED_SIZE: usize> Encode for Prio3PublicShare<SEED_SIZE>

source§

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

source§

impl<const VERIFY_KEY_SIZE: usize, const NONCE_SIZE: usize, A> Encode for PingPongTransition<VERIFY_KEY_SIZE, NONCE_SIZE, A>
where A: Aggregator<VERIFY_KEY_SIZE, NONCE_SIZE>, A::PrepareState: Encode,