Struct asn1_der::DerObject

source ·
pub struct DerObject<'a> { /* private fields */ }
Expand description

An untyped DER object

Implementations§

source§

impl<'a> DerObject<'a>

source

pub fn new<S: Sink + Into<&'a [u8]>>( tag: u8, value: &[u8], sink: S ) -> Result<Self, Asn1DerError>

Writes a new DER object with tag and value into sink and returns a view over it

source

pub fn new_from_source<A: Source, B: Sink + Into<&'a [u8]>>( tag: u8, len: usize, value: &mut A, sink: B ) -> Result<Self, Asn1DerError>

Writes a new DER object with tag, len and value into sink and returns a view over it

source

pub fn decode(raw: &'a [u8]) -> Result<Self, Asn1DerError>

Decodes an object from raw

source

pub fn decode_from_source<A: Source, B: Sink + Into<&'a [u8]>>( source: &mut A, sink: B ) -> Result<Self, Asn1DerError>

Reads a DER-TLV structure from source by parsing the length field and copying the necessary bytes into sink and returns a view over it

source

pub fn raw(self) -> &'a [u8]

The underlying raw slice

source

pub fn header(self) -> &'a [u8]

The object header

source

pub fn tag(self) -> u8

The object tag

source

pub fn value(self) -> &'a [u8]

The object value

source

pub fn encode<U: Sink>(&self, sink: &mut U) -> Result<(), Asn1DerError>

Encodes self to sink

source

pub fn write<A: Source, B: Sink>( tag: u8, len: usize, value: &mut A, sink: &mut B ) -> Result<(), Asn1DerError>

Writes a tag-len-value combination as DER-TLV structure into sink

Trait Implementations§

source§

impl<'a> Clone for DerObject<'a>

source§

fn clone(&self) -> DerObject<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> DerDecodable<'a> for DerObject<'a>

source§

fn load(object: DerObject<'a>) -> Result<Self, Asn1DerError>

Loads object as Self
source§

fn decode(raw: &'a [u8]) -> Result<Self, Asn1DerError>

Decodes an object as Self
source§

fn decode_at(raw: &'a [u8], header_start: usize) -> Result<Self, Asn1DerError>

Decodes an object as Self
source§

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
source§

impl<'a> DerEncodable for DerObject<'a>

source§

fn encode<S: Sink>(&self, sink: &mut S) -> Result<(), Asn1DerError>

Encodes self into sink
source§

fn der_object<'a, S: Sink + Into<&'a [u8]>>( &self, sink: S ) -> Result<DerObject<'a>, Asn1DerError>

Creates an DER object from an encodable type
source§

impl<'a> Copy for DerObject<'a>

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for DerObject<'a>

§

impl<'a> Send for DerObject<'a>

§

impl<'a> Sync for DerObject<'a>

§

impl<'a> Unpin for DerObject<'a>

§

impl<'a> UnwindSafe for DerObject<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.