Struct dns_message_parser::DomainName
source · [−]pub struct DomainName(_);
Expand description
Represent a domain name according to RFC 2181.
Implementations
sourceimpl DomainName
impl DomainName
pub fn decode(bytes: Bytes) -> DecodeResult<DomainName>
sourceimpl DomainName
impl DomainName
sourcepub fn append_label(&mut self, label: Label) -> Result<(), DomainNameError>
pub fn append_label(&mut self, label: Label) -> Result<(), DomainNameError>
Append a label to the domain name.
If the label cannot be appended then the domain name is not changed. The label cannot be appended if the domain name would be too big.
Example
let mut domain_name = DomainName::default();
// Prints "."
println!("{}", domain_name);
domain_name.append_label("example".parse().unwrap()).unwrap();
// Prints "example."
println!("{}", domain_name);
domain_name.append_label("org".parse().unwrap()).unwrap();
// Prints "example.org."
println!("{}", domain_name);
pub fn len(&self) -> usize
pub fn is_root(&self) -> bool
sourceimpl DomainName
impl DomainName
pub fn encode(&self) -> EncodeResult<BytesMut>
Trait Implementations
sourceimpl Clone for DomainName
impl Clone for DomainName
sourcefn clone(&self) -> DomainName
fn clone(&self) -> DomainName
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for DomainName
impl Debug for DomainName
sourceimpl Default for DomainName
impl Default for DomainName
sourcefn default() -> DomainName
fn default() -> DomainName
Returns the “default value” for a type. Read more
sourceimpl Display for DomainName
impl Display for DomainName
sourceimpl FromStr for DomainName
impl FromStr for DomainName
sourceimpl Hash for DomainName
impl Hash for DomainName
sourceimpl PartialEq<DomainName> for DomainName
impl PartialEq<DomainName> for DomainName
sourcefn eq(&self, other: &DomainName) -> bool
fn eq(&self, other: &DomainName) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &DomainName) -> bool
fn ne(&self, other: &DomainName) -> bool
This method tests for !=
.
impl Eq for DomainName
impl StructuralEq for DomainName
impl StructuralPartialEq for DomainName
Auto Trait Implementations
impl RefUnwindSafe for DomainName
impl Send for DomainName
impl Sync for DomainName
impl Unpin for DomainName
impl UnwindSafe for DomainName
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more