Struct trust_dns_proto::rr::domain::Label [−][src]
pub struct Label(_);
Labels are always stored as ASCII, unicode characters must be encoded with punycode
Methods
impl Label
[src]
impl Label
pub fn from_raw_bytes(bytes: &[u8]) -> ProtoResult<Self>
[src]
pub fn from_raw_bytes(bytes: &[u8]) -> ProtoResult<Self>
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) -> ProtoResult<Self>
[src]
pub fn from_utf8(s: &str) -> ProtoResult<Self>
Translates this string into IDNA safe name, encoding to punycode as necessary.
pub fn from_ascii(s: &str) -> ProtoResult<Self>
[src]
pub fn from_ascii(s: &str) -> ProtoResult<Self>
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) -> Self
[src]
pub fn to_lowercase(&self) -> Self
Converts this label to lowercase
pub fn is_wildcard(&self) -> bool
[src]
pub fn is_wildcard(&self) -> bool
Returns true if this label is the wildcard, '*', label
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Returns the lenght in bytes of this label
pub fn as_bytes(&self) -> &[u8]
[src]
pub fn as_bytes(&self) -> &[u8]
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: &Self) -> bool
[src]
pub fn eq_ignore_ascii_case(&self, other: &Self) -> bool
Performs the equivelence operation disregarding case
pub fn cmp_with_f<F: LabelCmp>(&self, other: &Self) -> Ordering
[src]
pub fn cmp_with_f<F: LabelCmp>(&self, other: &Self) -> Ordering
compares with the other label, ignoring case
pub fn to_utf8(&self) -> String
[src]
pub fn to_utf8(&self) -> String
Performs the conversion to utf8 from IDNA as necessary, see fmt
for more details
pub fn to_ascii(&self) -> String
[src]
pub fn to_ascii(&self) -> String
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: Write>(&self, f: &mut W) -> Result<(), Error>
[src]
pub fn write_ascii<W: Write>(&self, f: &mut W) -> Result<(), Error>
Writes this label to safe ascii, escaping characters as necessary
Trait Implementations
impl Clone for Label
[src]
impl Clone for Label
fn clone(&self) -> Label
[src]
fn clone(&self) -> Label
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Eq for Label
[src]
impl Eq for Label
impl AsRef<[u8]> for Label
[src]
impl AsRef<[u8]> for Label
impl Borrow<[u8]> for Label
[src]
impl Borrow<[u8]> for Label
impl Display for Label
[src]
impl Display for Label
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
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 Debug for Label
[src]
impl Debug for Label
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl PartialEq<Label> for Label
[src]
impl PartialEq<Label> for Label
fn eq(&self, other: &Self) -> bool
[src]
fn eq(&self, other: &Self) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl PartialOrd<Label> for Label
[src]
impl PartialOrd<Label> for Label
fn partial_cmp(&self, other: &Label) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Label) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for Label
[src]
impl Ord for Label
fn cmp(&self, other: &Self) -> Ordering
[src]
fn cmp(&self, other: &Self) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl Hash for Label
[src]
impl Hash for Label
fn hash<H>(&self, state: &mut H) where
H: Hasher,
[src]
fn hash<H>(&self, state: &mut H) where
H: Hasher,
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<'a> IntoLabel for &'a Label
[src]
impl<'a> IntoLabel for &'a Label
fn into_label(self) -> ProtoResult<Label>
[src]
fn into_label(self) -> ProtoResult<Label>
Convert this into Label
impl IntoLabel for Label
[src]
impl IntoLabel for Label
fn into_label(self) -> ProtoResult<Label>
[src]
fn into_label(self) -> ProtoResult<Label>
Convert this into Label