Trait Decode
pub trait Decode: Sized {
// Required method
fn decode(reader: &mut Reader) -> Result<Self, ValueError>;
}Expand description
A value that can be read from a TLV.
Required Methods§
fn decode(reader: &mut Reader) -> Result<Self, ValueError>
fn decode(reader: &mut Reader) -> Result<Self, ValueError>
Reads a value.
Call Reader::read instead, which infers the type.
§Errors
Returns an error if the input doesn’t start with a valid value.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
§impl Decode for bool
Decoded from a u8. Every value other than 0 is true, like in
Qualcomm’s decoder.
impl Decode for bool
Decoded from a u8. Every value other than 0 is true, like in
Qualcomm’s decoder.
fn decode(reader: &mut Reader) -> Result<Self, ValueError>
§impl<T: Decode + Default, const N: usize> Decode for [T; N]
Elements need a Default, so that decoding doesn’t allocate.
impl<T: Decode + Default, const N: usize> Decode for [T; N]
Elements need a Default, so that decoding doesn’t allocate.
fn decode(reader: &mut Reader) -> Result<Self, ValueError>
Implementors§
impl Decode for Bytes
Takes the rest of the input, like a TLV that contains only bytes.
impl Decode for QmiError
impl Decode for Status
QMI_RESULT_SUCCESS or QMI_RESULT_FAILURE, followed by the error.
impl Decode for Utf8Bytes
Takes the rest of the input, like a TLV that contains only a string.