pub struct Label<'a> { /* private fields */ }
Expand description
Represents a label in a domain name
A valid label is consists of A-Z, a-z, 0-9, and hyphen (-), and must be at most 63 characters in length. This library also considers valid any label starting with underscore (_), to be able to parse mDNS domain names.
Implementations§
source§impl<'a> Label<'a>
impl<'a> Label<'a>
sourcepub fn new<T: Into<Cow<'a, [u8]>>>(data: T) -> Result<Self>
pub fn new<T: Into<Cow<'a, [u8]>>>(data: T) -> Result<Self>
Create a new Label
if given data is valid and within the limits
sourcepub fn new_unchecked<T: Into<Cow<'a, [u8]>>>(data: T) -> Self
pub fn new_unchecked<T: Into<Cow<'a, [u8]>>>(data: T) -> Self
Create a new Label without checking for size limits or valid content. This function can be used to create labels with unicode characters
sourcepub fn into_owned<'b>(self) -> Label<'b>
pub fn into_owned<'b>(self) -> Label<'b>
Transforms the inner data into its owned type
Trait Implementations§
impl<'a> Eq for Label<'a>
impl<'a> StructuralPartialEq for Label<'a>
Auto Trait Implementations§
impl<'a> Freeze for Label<'a>
impl<'a> RefUnwindSafe for Label<'a>
impl<'a> Send for Label<'a>
impl<'a> Sync for Label<'a>
impl<'a> Unpin for Label<'a>
impl<'a> UnwindSafe for Label<'a>
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
Mutably borrows from an owned value. Read more
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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)