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

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 ExtensionType

Source§

impl Decode for FixedSizeQuery

Source§

impl Decode for HpkeAeadId

Source§

impl Decode for HpkeKdfId

Source§

impl Decode for HpkeKemId

Source§

impl Decode for PrepareError

Source§

impl Decode for PrepareStepResult

Source§

impl Decode for Role

Source§

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

Source§

impl Decode for Code

Source§

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

Source§

impl Decode for DpMechanism

Source§

impl Decode for Query

Source§

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

Source§

impl Decode for VdafType

Source§

impl Decode for u8

Source§

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

Source§

impl Decode for u16

Source§

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

Source§

impl Decode for u32

Source§

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

Source§

impl Decode for u64

Source§

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

Source§

impl Decode for ()

Source§

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

Source§

impl Decode for AggregateShare

Source§

impl Decode for AggregationJobContinueReq

Source§

impl Decode for AggregationJobResp

Source§

impl Decode for AggregationJobStep

Source§

impl Decode for BatchId

Source§

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

Source§

impl Decode for Duration

Source§

impl Decode for Extension

Source§

impl Decode for HpkeCiphertext

Source§

impl Decode for HpkeConfigId

Source§

impl Decode for HpkeConfigList

Source§

impl Decode for InputShareAad

Source§

impl Decode for Interval

Source§

impl Decode for PlaintextInputShare

Source§

impl Decode for PrepareContinue

Source§

impl Decode for PrepareInit

Source§

impl Decode for PrepareResp

Source§

impl Decode for Report

Source§

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

Source§

impl Decode for ReportId

Source§

impl Decode for ReportIdChecksum

Source§

impl Decode for ReportMetadata

Source§

impl Decode for ReportShare

Source§

impl Decode for TaskId

Source§

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

Source§

impl Decode for Time

Source§

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

Source§

impl Decode for Url

Source§

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

Source§

impl Decode for DpConfig

Source§

impl Decode for QueryConfig

Source§

impl Decode for TaskConfig

Source§

impl Decode for VdafConfig

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Implementors§