pub struct Name(/* private fields */);Expand description
Owned, canonical DNS name (lowercased on construction).
Implementations§
Source§impl Name
impl Name
Source§impl Name
impl Name
Sourcepub fn try_from_str(s: &str) -> Result<Name, NameError>
pub fn try_from_str(s: &str) -> Result<Name, NameError>
Constructs a Name from a string, validating label lengths and
total length, normalizing to canonical lowercase.
Sourcepub fn from_wire_labels<'a, E, I>(labels: I) -> Option<Name>
pub fn from_wire_labels<'a, E, I>(labels: I) -> Option<Name>
Builds a canonical Name directly from a sequence of raw wire labels
(each the decompressed bytes of one DNS label, no length prefix),
joining them with . plus a trailing .. Labels are ASCII case-folded
(RFC 4343); non-ASCII bytes are preserved, and the assembled name must
be valid UTF-8 — DNS-SD names are UTF-8 (RFC 6763 §4.1). Returns None
on a malformed label (Err item), a label containing the . separator
byte, non-UTF-8 bytes, or a label/total length violation.
This is the wire-decode counterpart to Name::try_from_str: it skips
the throwaway presentation String a caller would otherwise assemble
and — unlike a byte as char join — never Latin-1-reinterprets a
multi-byte UTF-8 sequence into mojibake.
Length limits are checked incrementally, before each label is decoded or pushed, so an oversized iterator is rejected without unbounded allocation.
Trait Implementations§
impl Eq for Name
impl StructuralPartialEq for Name
Auto Trait Implementations§
impl Freeze for Name
impl RefUnwindSafe for Name
impl Send for Name
impl Sync for Name
impl Unpin for Name
impl UnsafeUnpin for Name
impl UnwindSafe for Name
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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more