pub trait Composer: OctetsBuilder + AsRef<[u8]> + AsMut<[u8]> + Truncate {
// Provided methods
fn append_compressed_dname<N: ToDname + ?Sized>(
&mut self,
name: &N,
) -> Result<(), Self::AppendError> { ... }
fn can_compress(&self) -> bool { ... }
}
Provided Methods§
sourcefn append_compressed_dname<N: ToDname + ?Sized>(
&mut self,
name: &N,
) -> Result<(), Self::AppendError>
fn append_compressed_dname<N: ToDname + ?Sized>( &mut self, name: &N, ) -> Result<(), Self::AppendError>
Appends a domain name using name compression if supported.
Domain name compression attempts to lower the size of a DNS message by avoiding to include repeated domain name suffixes. Instead of adding the full suffix, a pointer to the location of the previous occurence is added. Since that occurence may itself contain a compressed suffix, doing name compression isn’t cheap and therefore optional. However, in order to be able to opt in, we need to know if we are dealing with a domain name that ought to be compressed.
The trait provides a default implementation which simply appends the name uncompressed.
fn can_compress(&self) -> bool
Object Safety§
This trait is not object safe.