pub struct DomainName {
pub labels: Vec<Label>,
pub len: usize,
}
Expand description
A domain name is a sequence of labels, where each label is a length octet followed by that number of octets.
A label must be 63 octets or shorter. A name must be 255 octets or shorter in total, including both length and label octets.
Fields§
§labels: Vec<Label>
§len: usize
Implementations§
Source§impl DomainName
impl DomainName
Sourcefn deserialise(
id: u16,
buffer: &mut ConsumableBuffer<'_>,
) -> Result<Self, Error>
fn deserialise( id: u16, buffer: &mut ConsumableBuffer<'_>, ) -> Result<Self, Error>
§Errors
If the domain cannot be parsed.
Source§impl DomainName
impl DomainName
fn serialise(&self, buffer: &mut WritableBuffer, compress: bool)
Source§impl DomainName
impl DomainName
pub fn root_domain() -> Self
pub fn is_root(&self) -> bool
pub fn is_subdomain_of(&self, other: &DomainName) -> bool
pub fn make_subdomain_of(&self, origin: &Self) -> Option<Self>
pub fn to_dotted_string(&self) -> String
pub fn from_relative_dotted_string(origin: &Self, s: &str) -> Option<Self>
pub fn from_dotted_string(s: &str) -> Option<Self>
pub fn from_labels(labels: Vec<Label>) -> Option<Self>
Trait Implementations§
Source§impl Clone for DomainName
impl Clone for DomainName
Source§fn clone(&self) -> DomainName
fn clone(&self) -> DomainName
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for DomainName
impl Debug for DomainName
Source§impl Display for DomainName
impl Display for DomainName
Source§impl FromStr for DomainName
impl FromStr for DomainName
Source§impl Hash for DomainName
impl Hash for DomainName
Source§impl Ord for DomainName
impl Ord for DomainName
Source§fn cmp(&self, other: &DomainName) -> Ordering
fn cmp(&self, other: &DomainName) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for DomainName
impl PartialEq for DomainName
Source§impl PartialOrd for DomainName
impl PartialOrd for DomainName
impl Eq for DomainName
impl StructuralPartialEq for DomainName
Auto Trait Implementations§
impl Freeze for DomainName
impl RefUnwindSafe for DomainName
impl Send for DomainName
impl Sync for DomainName
impl Unpin for DomainName
impl UnwindSafe for DomainName
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