Struct domain::bits::name::LabelBuf [−][src]
pub struct LabelBuf { /* fields omitted */ }
An owned domain name label.
This type is the owned companion of and derefs to Label
.
Methods
impl LabelBuf
[src]
impl LabelBuf
pub fn from_slice(label: &Label) -> Self
[src]
pub fn from_slice(label: &Label) -> Self
Creates an owned label from a label slice.
LabelBuf
also implements From<&Label>
, so the canonical form of
this function is actually label.into()
.
pub fn root() -> Self
[src]
pub fn root() -> Self
Returns an owned root label.
pub fn as_slice(&self) -> &Label
[src]
pub fn as_slice(&self) -> &Label
Returns a reference to a slice of the label.
Methods from Deref<Target = Label>
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Returns the length of the label.
This is equal to the length of the wire representation of the label.
For normal labels, it is one more than the length of the content.
For binary labels, things are a wee bit more complicated. See the
discussion of label encodings with the LabelContent
type for
more details.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Returns whether the label is empty.
(A well-formed label never is.)
pub fn is_root(&self) -> bool
[src]
pub fn is_root(&self) -> bool
Returns whether this label is the root label.
pub fn content(&self) -> LabelContent
[src]
pub fn content(&self) -> LabelContent
Returns the label’s content.
pub fn as_str(&self) -> Option<&str>
[src]
pub fn as_str(&self) -> Option<&str>
Returns a string slice if this is a normal label and purely ASCII.
To get a string representation of any label, you can use the
format!()
macro as Label
implements the Display
trait.
pub fn as_bytes(&self) -> &[u8]
[src]
pub fn as_bytes(&self) -> &[u8]
Returns a bytes slice with the raw content of this label.
ⓘImportant traits for LabelIter<'a>pub fn iter(&self) -> LabelIter
[src]
pub fn iter(&self) -> LabelIter
Returns an iterator over the labelettes in this label.
See ['Labelette'] for what labelettes are supposed to be.
Trait Implementations
impl<'a> From<&'a Label> for LabelBuf
[src]
impl<'a> From<&'a Label> for LabelBuf
impl Deref for LabelBuf
[src]
impl Deref for LabelBuf
type Target = Label
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
fn deref(&self) -> &Self::Target
Dereferences the value.
impl Borrow<Label> for LabelBuf
[src]
impl Borrow<Label> for LabelBuf
impl AsRef<Label> for LabelBuf
[src]
impl AsRef<Label> for LabelBuf
impl<T: AsRef<Label>> PartialEq<T> for LabelBuf
[src]
impl<T: AsRef<Label>> PartialEq<T> for LabelBuf
fn eq(&self, other: &T) -> bool
[src]
fn eq(&self, other: &T) -> 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 Eq for LabelBuf
[src]
impl Eq for LabelBuf
impl Hash for LabelBuf
[src]
impl Hash for LabelBuf
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash<H: Hasher>(&self, state: &mut H)
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 Display for LabelBuf
[src]
impl Display for LabelBuf
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Octal for LabelBuf
[src]
impl Octal for LabelBuf
impl LowerHex for LabelBuf
[src]
impl LowerHex for LabelBuf
impl UpperHex for LabelBuf
[src]
impl UpperHex for LabelBuf
impl Binary for LabelBuf
[src]
impl Binary for LabelBuf
impl Debug for LabelBuf
[src]
impl Debug for LabelBuf