Struct SequenceOf

Source
pub struct SequenceOf {
    pub inner: Vec<Box<dyn ASN1>>,
    /* private fields */
}
Expand description

A sequence of is dynamically build using a callback factory

Fields§

§inner: Vec<Box<dyn ASN1>>

The inner vector of ASN1 node

Implementations§

Source§

impl SequenceOf

Source

pub fn new() -> Self

Create an empty sequenceof

§Example
use rdp::nla::asn1::SequenceOf;
let so = SequenceOf::new();
Source

pub fn reader<F>(factory: F) -> Self
where F: Fn() -> Box<dyn ASN1> + 'static,

Build a sequence_of from a reader perspective

§Example
use rdp::nla::asn1::SequenceOf;
use rdp::nla::asn1::OctetString;
let so = SequenceOf::reader(|| Box::new(OctetString::new()));

Trait Implementations§

Source§

impl ASN1 for SequenceOf

Source§

fn write_asn1(&self, writer: DERWriter<'_>) -> RdpResult<()>

Write an ASN1 sequenceof model using a DERWriter

§Example
    let s = sequence_of![
        8 as Integer,
        9 as Integer
    ];
    assert_eq!(to_der(&s), [48, 6, 2, 1, 8, 2, 1, 9]);
Source§

fn read_asn1(&mut self, reader: BERReader<'_, '_>) -> RdpResult<()>

Read an ASN1 sequenceof model using a BerReader

§Example
    let mut s = SequenceOf::reader(|| Box::new(0 as Integer));
    from_der(&mut s, &[48, 6, 2, 1, 8, 2, 1, 9]).unwrap();
    assert_eq!(s.inner.len(), 2);
Source§

fn visit(&self) -> ASN1Type<'_>

Use to cast an ASN1 node into SequenceOf

§Example
    let mut s = SequenceOf::reader(|| Box::new(0 as Integer));
    from_der(&mut s, &[48, 6, 2, 1, 8, 2, 1, 9]).unwrap();
    assert_eq!(cast!(ASN1Type::SequenceOf, s).unwrap().inner.len(), 2);

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V