Trait prio::codec::ParameterizedEncode
source · pub trait ParameterizedEncode<P> {
// Required method
fn encode_with_param(
&self,
encoding_parameter: &P,
bytes: &mut Vec<u8>
) -> Result<(), CodecError>;
// Provided methods
fn get_encoded_with_param(
&self,
encoding_parameter: &P
) -> Result<Vec<u8>, CodecError> { ... }
fn encoded_len_with_param(&self, _encoding_parameter: &P) -> Option<usize> { ... }
}
Expand description
Describes how to encode objects into a byte sequence.
Required Methods§
sourcefn encode_with_param(
&self,
encoding_parameter: &P,
bytes: &mut Vec<u8>
) -> Result<(), CodecError>
fn encode_with_param( &self, encoding_parameter: &P, bytes: &mut Vec<u8> ) -> Result<(), CodecError>
Append the encoded form of this object to the end of bytes
, growing the vector as needed.
encoding_parameter
provides details of the wire encoding, used to control how the value
is encoded.
Provided Methods§
sourcefn get_encoded_with_param(
&self,
encoding_parameter: &P
) -> Result<Vec<u8>, CodecError>
fn get_encoded_with_param( &self, encoding_parameter: &P ) -> Result<Vec<u8>, CodecError>
Convenience method to encode a value into a new Vec<u8>
.
sourcefn encoded_len_with_param(&self, _encoding_parameter: &P) -> Option<usize>
fn encoded_len_with_param(&self, _encoding_parameter: &P) -> Option<usize>
Returns an optional hint indicating how many bytes will be required to encode this value, or
None
by default.