Trait domain::bits::name::DName [−][src]
pub trait DName: Sized { fn to_cow(&self) -> Cow<DNameSlice>; fn labels(&self) -> NameLabels; fn labelettes(&self) -> NameLabelettes { ... } fn compose<C: AsMut<Composer>>(&self, composer: C) -> ComposeResult<()> { ... } fn compose_compressed<C: AsMut<Composer>>(
&self,
composer: C
) -> ComposeResult<()> { ... } }
A trait implemented by all domain name types.
The purpose of the trait is to allow building composite types that are
generic over all possible variants of domain names. In particular,
DName
is implemented for &DNameSlice
for references to uncompressed
domain names, DNameBuf
for owned uncompressed domain names, and
ParsedDName
for domain names parsed from DNS messages.
If you don’t need to include ParsedDName
, you might want your type
to be generic over AsRef<DNameSlice>
instead as this allows for the
full range of functionality provided by DNameSlice
.
Required Methods
fn to_cow(&self) -> Cow<DNameSlice>
Converts the name into an uncompressed name.
Since unpacking parsed domain names may need allocations to collect the labels, the return value is a cow. This cow will, however, be of the borrowed variant whenever possible.
fn labels(&self) -> NameLabels
Returns an iterator over the labels of the domain name.
Provided Methods
fn labelettes(&self) -> NameLabelettes
Returns an iterator over the labelettes of the domain name.
See Labelette
for a discussion of what exactly labelettes are.
fn compose<C: AsMut<Composer>>(&self, composer: C) -> ComposeResult<()>
Appends the name to the end of a composition.
fn compose_compressed<C: AsMut<Composer>>(
&self,
composer: C
) -> ComposeResult<()>
&self,
composer: C
) -> ComposeResult<()>
Appends the name to the end of a composition using name compression.
Implementors
impl<'a> DName for ParsedDName<'a>
impl<'a> DName for &'a DNameSlice
impl DName for DNameBuf
impl<'a> DName for &'a DNameBuf