Trait prio::codec::ParameterizedDecode
source · pub trait ParameterizedDecode<P>: Sized {
// Required method
fn decode_with_param(
decoding_parameter: &P,
bytes: &mut Cursor<&[u8]>
) -> Result<Self, CodecError>;
// Provided method
fn get_decoded_with_param(
decoding_parameter: &P,
bytes: &[u8]
) -> Result<Self, CodecError> { ... }
}
Expand description
Describes how to decode an object from a byte sequence and a decoding parameter that provides additional context.
Required Methods§
sourcefn decode_with_param(
decoding_parameter: &P,
bytes: &mut Cursor<&[u8]>
) -> Result<Self, CodecError>
fn decode_with_param( decoding_parameter: &P, bytes: &mut Cursor<&[u8]> ) -> Result<Self, CodecError>
Read and decode an encoded object from bytes
. decoding_parameter
provides details of the
wire encoding such as lengths of different portions of the message. 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§
sourcefn get_decoded_with_param(
decoding_parameter: &P,
bytes: &[u8]
) -> Result<Self, CodecError>
fn get_decoded_with_param( decoding_parameter: &P, bytes: &[u8] ) -> Result<Self, CodecError>
Convenience method to get a decoded value. Returns an error if Self::decode_with_param
fails, or if there are any bytes left in bytes
after decoding a value.
Object Safety§
This trait is not object safe.
Implementors§
impl ParameterizedDecode<Poplar1PrepareState> for Poplar1FieldVec
Available on crate features
crypto-dependencies
and experimental
only.impl ParameterizedDecode<Poplar1PrepareState> for Poplar1PrepareMessage
Available on crate features
crypto-dependencies
and experimental
only.impl<'a> ParameterizedDecode<(&'a Prio2, usize)> for Prio2PrepareState
Available on crate features
crypto-dependencies
and experimental
only.impl<'a, P, const SEED_SIZE: usize> ParameterizedDecode<(&'a Poplar1<P, SEED_SIZE>, usize)> for Poplar1PrepareState
Available on crate features
crypto-dependencies
and experimental
only.impl<'a, P: Xof<SEED_SIZE>, const SEED_SIZE: usize> ParameterizedDecode<(&'a Poplar1<P, SEED_SIZE>, &'a Poplar1AggregationParam)> for Poplar1FieldVec
Available on crate features
crypto-dependencies
and experimental
only.impl<'a, T, P, const SEED_SIZE: usize> ParameterizedDecode<(&'a Prio3<T, P, SEED_SIZE>, usize)> for Prio3PrepareState<T::Field, SEED_SIZE>
impl<D: Decode + ?Sized, T> ParameterizedDecode<T> for D
Provide a blanket implementation so that any Decode
can be used as a
ParameterizedDecode<T>
for any T
.
impl<F: FftFriendlyFieldElement, const SEED_SIZE: usize> ParameterizedDecode<Prio3PrepareState<F, SEED_SIZE>> for Prio3PrepareMessage<SEED_SIZE>
impl<F: FieldElement> ParameterizedDecode<<VidpfWeight<F> as IdpfValue>::ValueParameter> for VidpfWeight<F>
Available on crate features
crypto-dependencies
and experimental
only.