[][src]Struct yasna::models::TaggedDerValue

pub struct TaggedDerValue { /* fields omitted */ }

Container for a tag and arbitrary DER value.

When obtained by BERReader::read_tagged_der in DER mode, the reader verifies that the payload is actually valid DER. When constructed from bytes, the caller is responsible for providing valid DER.

Methods

impl TaggedDerValue[src]

pub fn from_octetstring(bytes: Vec<u8>) -> Self[src]

Constructs a new TaggedDerValue as an octet string

pub fn from_tag_and_bytes(tag: Tag, bytes: Vec<u8>) -> Self[src]

Constructs a new TaggedDerValue from its tag and content

pub fn from_tag_pc_and_bytes(tag: Tag, pcbit: PCBit, bytes: Vec<u8>) -> Self[src]

Constructs a new TaggedDerValue from its tag, primitive/constructed bit, and content

pub fn tag(&self) -> Tag[src]

Returns the tag

pub fn pcbit(&self) -> PCBit[src]

Returns the primitive/constructed bit

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

Returns the value

pub fn as_bytes(&self) -> Option<&[u8]>[src]

If the value is something that contains raw bytes, returns its content.

Examples

use yasna::models::TaggedDerValue;
let value = TaggedDerValue::from_octetstring(vec![1, 2, 3, 4, 5, 6]);
assert!(value.as_bytes() == Some(&[1, 2, 3, 4, 5, 6]));

pub fn as_str(&self) -> Option<&str>[src]

If the value is something string-like, returns it as string.

Trait Implementations

impl BERDecodable for TaggedDerValue[src]

impl Clone for TaggedDerValue[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl PartialEq<TaggedDerValue> for TaggedDerValue[src]

impl PartialOrd<TaggedDerValue> for TaggedDerValue[src]

impl Ord for TaggedDerValue[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Returns max if self is greater than max, and min if self is less than min. Otherwise this will return self. Panics if min > max. Read more

impl Eq for TaggedDerValue[src]

impl Hash for TaggedDerValue[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Debug for TaggedDerValue[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]