pub struct DomainName(/* private fields */);
Expand description
Represent a domain name according to RFC 2181.
Implementations§
Source§impl DomainName
impl DomainName
pub fn decode(bytes: Bytes) -> DecodeResult<DomainName>
Source§impl 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
Source§impl DomainName
impl DomainName
pub fn encode(&self) -> EncodeResult<BytesMut>
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 Default for DomainName
impl Default for DomainName
Source§fn default() -> DomainName
fn default() -> DomainName
Returns the “default value” for a type. Read more
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 PartialEq for DomainName
impl PartialEq 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