Trait 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 ExtensionType

Source§

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

Source§

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

Source§

impl Encode for FixedSizeQuery

Source§

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

Source§

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

Source§

impl Encode for HpkeAeadId

Source§

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

Source§

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

Source§

impl Encode for HpkeKdfId

Source§

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

Source§

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

Source§

impl Encode for HpkeKemId

Source§

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

Source§

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

Source§

impl Encode for PrepareError

Source§

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

Source§

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

Source§

impl Encode for PrepareStepResult

Source§

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

Source§

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

Source§

impl Encode for Role

Source§

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

Source§

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

Source§

impl Encode for Code

Source§

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

Source§

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

Source§

impl Encode for DpMechanism

Source§

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

Source§

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

Source§

impl Encode for Query

Source§

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

Source§

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

Source§

impl Encode for VdafType

Source§

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

Source§

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

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>

Source§

impl Encode for AggregateShare

Source§

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

Source§

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

Source§

impl Encode for AggregationJobContinueReq

Source§

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

Source§

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

Source§

impl Encode for AggregationJobResp

Source§

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

Source§

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

Source§

impl Encode for AggregationJobStep

Source§

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

Source§

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

Source§

impl Encode for BatchId

Source§

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

Source§

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

Source§

impl Encode for Duration

Source§

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

Source§

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

Source§

impl Encode for Extension

Source§

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

Source§

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

Source§

impl Encode for HpkeCiphertext

Source§

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

Source§

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

Source§

impl Encode for HpkeConfigId

Source§

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

Source§

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

Source§

impl Encode for HpkeConfigList

Source§

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

Source§

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

Source§

impl Encode for InputShareAad

Source§

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

Source§

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

Source§

impl Encode for Interval

Source§

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

Source§

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

Source§

impl Encode for PlaintextInputShare

Source§

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

Source§

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

Source§

impl Encode for PrepareContinue

Source§

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

Source§

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

Source§

impl Encode for PrepareInit

Source§

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

Source§

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

Source§

impl Encode for PrepareResp

Source§

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

Source§

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

Source§

impl Encode for Report

Source§

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

Source§

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

Source§

impl Encode for ReportId

Source§

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

Source§

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

Source§

impl Encode for ReportIdChecksum

Source§

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

Source§

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

Source§

impl Encode for ReportMetadata

Source§

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

Source§

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

Source§

impl Encode for ReportShare

Source§

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

Source§

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

Source§

impl Encode for TaskId

Source§

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

Source§

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

Source§

impl Encode for Time

Source§

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

Source§

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

Source§

impl Encode for Url

Source§

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

Source§

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

Source§

impl Encode for DpConfig

Source§

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

Source§

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

Source§

impl Encode for QueryConfig

Source§

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

Source§

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

Source§

impl Encode for TaskConfig

Source§

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

Source§

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

Source§

impl Encode for VdafConfig

Source§

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

Source§

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

Source§

impl<Q> Encode for AggregateShareAad<Q>
where Q: QueryType,

Source§

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

Source§

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

Source§

impl<Q> Encode for AggregateShareReq<Q>
where Q: QueryType,

Source§

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

Source§

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

Source§

impl<Q> Encode for AggregationJobInitializeReq<Q>
where Q: QueryType,

Source§

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

Source§

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

Source§

impl<Q> Encode for BatchSelector<Q>
where Q: QueryType,

Source§

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

Source§

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

Source§

impl<Q> Encode for Collection<Q>
where Q: QueryType,

Source§

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

Source§

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

Source§

impl<Q> Encode for CollectionReq<Q>
where Q: QueryType,

Source§

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

Source§

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

Source§

impl<Q> Encode for PartialBatchSelector<Q>
where Q: QueryType,

Source§

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

Source§

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

Source§

impl<Q> Encode for Query<Q>
where Q: QueryType,

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

Source§

impl Encode for Field255

Source§

impl Encode for Field64

Source§

impl Encode for Field128

Source§

impl Encode for FieldPrio2

Source§

impl Encode for MasticAggregationParam

Source§

impl Encode for Poplar1AggregationParam

Source§

impl Encode for Poplar1PrepareMessage

Source§

impl Encode for Poplar1PrepareState

Source§

impl Encode for Prio2PrepareShare

Source§

impl Encode for Prio2PrepareState

Source§

impl Encode for HpkeConfig

Source§

impl Encode for HpkePublicKey

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

impl<W> Encode for VidpfPublicShare<W>
where W: VidpfValue,

Source§

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

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 as Aggregator<VERIFY_KEY_SIZE, NONCE_SIZE>>::PrepareState: Encode,