Struct der::Utf8String[][src]

pub struct Utf8String<'a> { /* fields omitted */ }
Expand description

ASN.1 UTF8String type.

Supports the full UTF-8 encoding.

Note that the Decodable and Encodable traits are impl’d for Rust’s str primitive, which decodes/encodes as a Utf8String.

You are free to use str instead of this type, however it’s still provided for explicitness in cases where it might be ambiguous with other ASN.1 string encodings such as PrintableString.

Implementations

impl<'a> Utf8String<'a>[src]

pub fn new<T: ?Sized>(input: &'a T) -> Result<Self> where
    T: AsRef<[u8]>, 
[src]

Create a new ASN.1 UTF8String.

pub fn as_str(&self) -> &'a str[src]

Borrow the string as a str.

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

Borrow the string as bytes.

pub fn len(&self) -> Length[src]

Get the length of the inner byte slice.

pub fn is_empty(&self) -> bool[src]

Is the inner string empty?

Trait Implementations

impl AsRef<[u8]> for Utf8String<'_>[src]

fn as_ref(&self) -> &[u8][src]

Performs the conversion.

impl AsRef<str> for Utf8String<'_>[src]

fn as_ref(&self) -> &str[src]

Performs the conversion.

impl<'a> Clone for Utf8String<'a>[src]

fn clone(&self) -> Utf8String<'a>[src]

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl<'a> Debug for Utf8String<'a>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<'a> Display for Utf8String<'a>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<'a> Encodable for Utf8String<'a>[src]

fn encoded_len(&self) -> Result<Length>[src]

Compute the length of this value in bytes when encoded as ASN.1 DER.

fn encode(&self, encoder: &mut Encoder<'_>) -> Result<()>[src]

Encode this value as ASN.1 DER using the provided Encoder.

fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8]>[src]

Encode this value to the provided byte slice, returning a sub-slice containing the encoded message. Read more

fn encode_to_vec(&self, buf: &mut Vec<u8>) -> Result<Length>[src]

This is supported on crate feature alloc only.

Encode this message as ASN.1 DER, appending it to the provided byte vector. Read more

fn to_vec(&self) -> Result<Vec<u8>>[src]

This is supported on crate feature alloc only.

Serialize this message as a byte vector.

impl<'a> From<&'_ Utf8String<'a>> for Utf8String<'a>[src]

fn from(value: &Utf8String<'a>) -> Utf8String<'a>[src]

Performs the conversion.

impl<'a> From<Utf8String<'a>> for Any<'a>[src]

fn from(printable_string: Utf8String<'a>) -> Any<'a>[src]

Performs the conversion.

impl<'a> Ord for Utf8String<'a>[src]

fn cmp(&self, other: &Utf8String<'a>) -> Ordering[src]

This method returns an Ordering between self and other. Read more

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

Compares and returns the maximum of two values. Read more

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

Compares and returns the minimum of two values. Read more

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

Restrict a value to a certain interval. Read more

impl<'a> PartialEq<Utf8String<'a>> for Utf8String<'a>[src]

fn eq(&self, other: &Utf8String<'a>) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Utf8String<'a>) -> bool[src]

This method tests for !=.

impl<'a> PartialOrd<Utf8String<'a>> for Utf8String<'a>[src]

fn partial_cmp(&self, other: &Utf8String<'a>) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<'a> Tagged for Utf8String<'a>[src]

const TAG: Tag[src]

ASN.1 tag

impl<'a> TryFrom<Any<'a>> for Utf8String<'a>[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(any: Any<'a>) -> Result<Utf8String<'a>>[src]

Performs the conversion.

impl<'a> Copy for Utf8String<'a>[src]

impl<'a> Eq for Utf8String<'a>[src]

impl<'a> StructuralEq for Utf8String<'a>[src]

impl<'a> StructuralPartialEq for Utf8String<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Utf8String<'a>

impl<'a> Send for Utf8String<'a>

impl<'a> Sync for Utf8String<'a>

impl<'a> Unpin for Utf8String<'a>

impl<'a> UnwindSafe for Utf8String<'a>

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

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

recently added

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

impl<T> ToString for T where
    T: Display + ?Sized
[src]

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

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

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

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

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

The type returned in the event of a conversion error.

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

Performs the conversion.