Trait asn1_der::typed::DerDecodable
source · pub trait DerDecodable<'a>: Sized {
// Required method
fn load(object: DerObject<'a>) -> Result<Self, Asn1DerError>;
// Provided methods
fn decode(raw: &'a [u8]) -> Result<Self, Asn1DerError> { ... }
fn decode_at(
raw: &'a [u8],
header_start: usize
) -> Result<Self, Asn1DerError> { ... }
fn decode_from_source<A: Source, B: Sink + Into<&'a [u8]>>(
source: &mut A,
sink: B
) -> Result<Self, Asn1DerError> { ... }
}
Expand description
A trait for DER decodable types
Required Methods§
sourcefn load(object: DerObject<'a>) -> Result<Self, Asn1DerError>
fn load(object: DerObject<'a>) -> Result<Self, Asn1DerError>
Loads object
as Self
Provided Methods§
sourcefn decode(raw: &'a [u8]) -> Result<Self, Asn1DerError>
fn decode(raw: &'a [u8]) -> Result<Self, Asn1DerError>
Decodes an object as Self
sourcefn decode_at(raw: &'a [u8], header_start: usize) -> Result<Self, Asn1DerError>
fn decode_at(raw: &'a [u8], header_start: usize) -> Result<Self, Asn1DerError>
Decodes an object as Self
sourcefn decode_from_source<A: Source, B: Sink + Into<&'a [u8]>>(
source: &mut A,
sink: B
) -> Result<Self, Asn1DerError>
fn decode_from_source<A: Source, B: Sink + Into<&'a [u8]>>( source: &mut A, sink: B ) -> Result<Self, Asn1DerError>
Reads an object from source
by parsing the length field and copying the necessary bytes
into sink
and decoding it from sink