Trait domain::base::wire::Composer

source ·
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§

source

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.

source

fn can_compress(&self) -> bool

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Composer for BytesMut

source§

impl Composer for Vec<u8>

source§

impl<A: Array<Item = u8>> Composer for SmallVec<A>

source§

impl<T: Composer> Composer for &mut T

source§

fn append_compressed_dname<N: ToDname + ?Sized>( &mut self, name: &N, ) -> Result<(), Self::AppendError>

source§

fn can_compress(&self) -> bool

source§

impl<const N: usize> Composer for Array<N>

Implementors§

source§

impl<Target> Composer for StreamTarget<Target>
where Target: Composer, Target::AppendError: Into<ShortBuf>,

source§

impl<Target: Composer> Composer for StaticCompressor<Target>

source§

impl<Target: Composer> Composer for TreeCompressor<Target>