Struct domain::base::name::OwnedLabel
source · pub struct OwnedLabel(/* private fields */);
Expand description
An owned label.
Since labels are relatively short, this type doesn’t actually allocate any memory but is a 64 octet array.
Implementations§
source§impl OwnedLabel
impl OwnedLabel
sourcepub fn from_label(label: &Label) -> Self
pub fn from_label(label: &Label) -> Self
Creates a new owned label from an existing label.
sourcepub fn from_chars(
chars: impl Iterator<Item = char>,
) -> Result<Self, LabelFromStrError>
pub fn from_chars( chars: impl Iterator<Item = char>, ) -> Result<Self, LabelFromStrError>
Creates a label from a sequence of chars.
sourcepub fn make_canonical(&mut self)
pub fn make_canonical(&mut self)
Converts the label into the canonical form.
This form has all octets representing ASCII letters converted to their lower case form.
sourcepub fn as_label_mut(&mut self) -> &mut Label
pub fn as_label_mut(&mut self) -> &mut Label
Returns a mutable reference to the label.
sourcepub fn as_wire_slice(&self) -> &[u8] ⓘ
pub fn as_wire_slice(&self) -> &[u8] ⓘ
Returns a slice that is the wire-representation of the label.
Methods from Deref<Target = Label>§
pub const MAX_LEN: usize = 63usize
sourcepub fn as_slice_mut(&mut self) -> &mut [u8] ⓘ
pub fn as_slice_mut(&mut self) -> &mut [u8] ⓘ
Returns a mutable reference to the underlying octets slice.
sourcepub fn make_canonical(&mut self)
pub fn make_canonical(&mut self)
Converts the label into the canonical form.
This form has all octets representing ASCII letters converted to their lower case form.
sourcepub fn to_canonical(&self) -> OwnedLabel
pub fn to_canonical(&self) -> OwnedLabel
Returns the label in canonical form.
In this form, all ASCII letters are lowercase.
sourcepub fn composed_cmp(&self, other: &Self) -> Ordering
pub fn composed_cmp(&self, other: &Self) -> Ordering
Returns the composed label ordering.
sourcepub fn lowercase_composed_cmp(&self, other: &Self) -> Ordering
pub fn lowercase_composed_cmp(&self, other: &Self) -> Ordering
Returns the composed ordering with ASCII letters lowercased.
sourcepub fn compose<Builder: OctetsBuilder + ?Sized>(
&self,
target: &mut Builder,
) -> Result<(), Builder::AppendError>
pub fn compose<Builder: OctetsBuilder + ?Sized>( &self, target: &mut Builder, ) -> Result<(), Builder::AppendError>
Appends the label to an octets builder.
The method builds the encoded form of the label that starts with a one octet length indicator.
sourcepub fn compose_canonical<Builder: OctetsBuilder + ?Sized>(
&self,
target: &mut Builder,
) -> Result<(), Builder::AppendError>
pub fn compose_canonical<Builder: OctetsBuilder + ?Sized>( &self, target: &mut Builder, ) -> Result<(), Builder::AppendError>
Appends the lowercased label to an octets builder.
The method builds the encoded form of the label that starts with a one octet length indicator. It also converts all ASCII letters into their lowercase form.
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the length of the label.
This length is that of the label’s content only. It will not contain the initial label length octet present in the wire format.
sourcepub fn is_wildcard(&self) -> bool
pub fn is_wildcard(&self) -> bool
Returns whether the label is the wildcard label.
sourcepub fn compose_len(&self) -> u16
pub fn compose_len(&self) -> u16
Returns the length of the composed version of the label.
This length is one more than the length of the label as their is a leading length octet.
Trait Implementations§
source§impl AsMut<[u8]> for OwnedLabel
impl AsMut<[u8]> for OwnedLabel
source§impl AsMut<Label> for OwnedLabel
impl AsMut<Label> for OwnedLabel
source§impl AsRef<[u8]> for OwnedLabel
impl AsRef<[u8]> for OwnedLabel
source§impl AsRef<Label> for OwnedLabel
impl AsRef<Label> for OwnedLabel
source§impl Borrow<Label> for OwnedLabel
impl Borrow<Label> for OwnedLabel
source§impl BorrowMut<Label> for OwnedLabel
impl BorrowMut<Label> for OwnedLabel
source§fn borrow_mut(&mut self) -> &mut Label
fn borrow_mut(&mut self) -> &mut Label
source§impl Clone for OwnedLabel
impl Clone for OwnedLabel
source§fn clone(&self) -> OwnedLabel
fn clone(&self) -> OwnedLabel
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for OwnedLabel
impl Debug for OwnedLabel
source§impl Deref for OwnedLabel
impl Deref for OwnedLabel
source§impl DerefMut for OwnedLabel
impl DerefMut for OwnedLabel
source§impl Display for OwnedLabel
impl Display for OwnedLabel
source§impl<'a> From<&'a Label> for OwnedLabel
impl<'a> From<&'a Label> for OwnedLabel
source§impl FromStr for OwnedLabel
impl FromStr for OwnedLabel
source§impl Hash for OwnedLabel
impl Hash for OwnedLabel
source§impl Ord for OwnedLabel
impl Ord for OwnedLabel
source§impl<T: AsRef<Label>> PartialOrd<T> for OwnedLabel
impl<T: AsRef<Label>> PartialOrd<T> for OwnedLabel
impl Copy for OwnedLabel
impl Eq for OwnedLabel
Auto Trait Implementations§
impl Freeze for OwnedLabel
impl RefUnwindSafe for OwnedLabel
impl Send for OwnedLabel
impl Sync for OwnedLabel
impl Unpin for OwnedLabel
impl UnwindSafe for OwnedLabel
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)