[][src]Struct trust_dns::rr::Label

pub struct Label(_);

Labels are always stored as ASCII, unicode characters must be encoded with punycode

Methods

impl Label
[src]

pub fn from_raw_bytes(bytes: &[u8]) -> Result<Label, ProtoError>
[src]

These must only be ASCII, with unicode encoded to PunyCode, or other such transformation.

This uses the bytes as raw ascii values, with nothing escaped on the wire. Generally users should use from_str or from_ascii

pub fn from_utf8(s: &str) -> Result<Label, ProtoError>
[src]

Translates this string into IDNA safe name, encoding to punycode as necessary.

pub fn from_ascii(s: &str) -> Result<Label, ProtoError>
[src]

Takes the ascii string and returns a new label.

This will return an Error if the label is not an ascii string

pub fn to_lowercase(&self) -> Label
[src]

Converts this label to lowercase

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

Returns true if this label is the wildcard, '*', label

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

Returns the lenght in bytes of this label

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

True if the label contains no characters

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

Returns the raw bytes of the label, this is good for writing to the wire.

See [Display] for presentation version (unescaped from punycode, etc)

pub fn eq_ignore_ascii_case(&self, other: &Label) -> bool
[src]

Performs the equivelence operation disregarding case

pub fn cmp_with_f<F>(&self, other: &Label) -> Ordering where
    F: LabelCmp, 
[src]

compares with the other label, ignoring case

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

Performs the conversion to utf8 from IDNA as necessary, see fmt for more details

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

Converts this label to safe ascii, escaping characters as necessary

If this is an IDNA, punycode, label, then the xn-- prefix will be maintained as ascii

pub fn write_ascii<W>(&self, f: &mut W) -> Result<(), Error> where
    W: Write
[src]

Writes this label to safe ascii, escaping characters as necessary

Trait Implementations

impl Clone for Label
[src]

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

Performs copy-assignment from source. Read more

impl Eq for Label
[src]

impl Display for Label
[src]

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

outputs characters in a safe string manner.

if the string is punycode, i.e. starts with xn--, otherwise it translates to a safe ascii string escaping characters as necessary.

impl AsRef<[u8]> for Label
[src]

impl PartialOrd<Label> for Label
[src]

#[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 Hash for Label
[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 Label
[src]

impl Ord for Label
[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

impl PartialEq<Label> for Label
[src]

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

This method tests for !=.

impl Borrow<[u8]> for Label
[src]

impl IntoLabel for Label
[src]

impl<'a> IntoLabel for &'a Label
[src]

Auto Trait Implementations

impl Send for Label

impl Sync for Label

Blanket Implementations

impl<T> From for T
[src]

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

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

type Owned = T

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

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

type Error = !

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

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.

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

impl<T> Erased for T