Struct asn1_der::typed::Sequence

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

An ASN.1-DER sequence view

Implementations§

source§

impl<'a> Sequence<'a>

source

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

Writes a new sequence object with objs as subobjects into sink and returns a type view over it

source

pub fn len(&self) -> usize

The amount of subelements in the sequence

Note: since there is no underlying index, the amount of subelements has to be recomputed every time. If you need the length more than once, consider caching it.

source

pub fn get(&self, n: usize) -> Result<DerObject<'a>, Asn1DerError>

Gets the nth subobject

Note: since there is no underlying index, the position of each subelement has to be recomputed every time. If you need the subobjects more than once, consider caching them.

source

pub fn get_as<T: DerDecodable<'a>>(&self, n: usize) -> Result<T, Asn1DerError>

Gets the nth subobject as T

Note: since there is no underlying index, the position of each subelement has to be recomputed every time. If you need the subobjects more than once, consider caching them.

source

pub fn write<S: Sink, T: DerEncodable>( objs: &[T], sink: &mut S ) -> Result<(), Asn1DerError>

Writes a sequence consisting of objs as DER-object to sink

Trait Implementations§

source§

impl<'a> Clone for Sequence<'a>

source§

fn clone(&self) -> Sequence<'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 Sequence<'a>

source§

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

Loads the Sequence and performs a shallow validation that each underlying object is a valid DER object

Note: This function does not look “into” the underlying elements nor does it perform any type-specific validation – only the tag-length constructions are validated.

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 Sequence<'a>

source§

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

Encodes self to 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> DerTypeView<'a> for Sequence<'a>

source§

const TAG: u8 = 48u8

The tag for this type
source§

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

Provides raw access to the underlying DerObject
source§

impl<'a> Copy for Sequence<'a>

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Sequence<'a>

§

impl<'a> Send for Sequence<'a>

§

impl<'a> Sync for Sequence<'a>

§

impl<'a> Unpin for Sequence<'a>

§

impl<'a> UnwindSafe for Sequence<'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.