pub trait Composer:
OctetsBuilder
+ AsRef<[u8]>
+ AsMut<[u8]>
+ Truncate {
// Provided methods
fn append_compressed_name<N: ToName + ?Sized>(
&mut self,
name: &N,
) -> Result<(), Self::AppendError> { ... }
fn can_compress(&self) -> bool { ... }
}Provided Methods§
Sourcefn append_compressed_name<N: ToName + ?Sized>(
&mut self,
name: &N,
) -> Result<(), Self::AppendError>
fn append_compressed_name<N: ToName + ?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
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
impl Composer for BytesMut
Available on crate feature
bytes only.impl Composer for Vec<u8>
Available on crate feature
std only.impl<A: Array<Item = u8>> Composer for SmallVec<A>
Available on crate feature
smallvec only.Source§impl<T: Composer> Composer for &mut T
impl<T: Composer> Composer for &mut T
fn append_compressed_name<N: ToName + ?Sized>( &mut self, name: &N, ) -> Result<(), Self::AppendError>
fn can_compress(&self) -> bool
impl<const N: usize> Composer for Array<N>
Implementors§
impl<Target> Composer for StreamTarget<Target>
impl<Target: Composer> Composer for HashCompressor<Target>
Available on crate feature
std only.impl<Target: Composer> Composer for StaticCompressor<Target>
impl<Target: Composer> Composer for TreeCompressor<Target>
Available on crate feature
std only.