Struct ExplicitTag

Source
pub struct ExplicitTag<T> { /* private fields */ }
Expand description

Explicit tag is quite often use in microsoft specification

Implementations§

Source§

impl<T> ExplicitTag<T>

Source

pub fn new(tag: Tag, inner: T) -> Self

Create a new explicit tag

§Example
extern crate yasna;
use rdp::nla::asn1::{ExplicitTag, Integer};
use yasna::Tag;
let s = ExplicitTag::new(Tag::context(0), 2 as Integer);
Source

pub fn inner(self) -> T

return the inner object

Trait Implementations§

Source§

impl<T: ASN1> ASN1 for ExplicitTag<T>

Source§

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

Write an ASN1 Node with an explicit tag using a DERWriter

§Example
    let s = ExplicitTag::new(Tag::context(0), vec![0, 1, 2, 3]);
    assert_eq!(to_der(&s), [160, 6, 4, 4, 0, 1, 2, 3]);
Source§

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

Read an ASN1 Explicit tag using a BerReader

§Example
    let mut s = ExplicitTag::new(Tag::context(0), OctetString::new());
    from_der(&mut s, &[160, 6, 4, 4, 0, 1, 2, 3]).unwrap();
    assert_eq!(s.inner().len(), 4);
Source§

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

Allow to cast the ASN1 inner type

§Example
    let mut s = ExplicitTag::new(Tag::context(0), OctetString::new());
    from_der(&mut s, &[160, 6, 4, 4, 0, 1, 2, 3]).unwrap();
    assert_eq!(cast!(ASN1Type::OctetString, s).unwrap(), &[0, 1, 2, 3]);

Auto Trait Implementations§

§

impl<T> Freeze for ExplicitTag<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for ExplicitTag<T>
where T: RefUnwindSafe,

§

impl<T> Send for ExplicitTag<T>
where T: Send,

§

impl<T> Sync for ExplicitTag<T>
where T: Sync,

§

impl<T> Unpin for ExplicitTag<T>
where T: Unpin,

§

impl<T> UnwindSafe for ExplicitTag<T>
where T: UnwindSafe,

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