Skip to main content

StaticCompressor

Struct StaticCompressor 

Source
pub struct StaticCompressor<Target> { /* private fields */ }
Expand description

A domain name compressor that doesn’t require an allocator.

This type wraps around an octets builder and implements domain name compression. It does not require an allocator but because of that it can only remember the position of up to 24 domain names. This should be sufficient for most messages.

The position of a domain name is calculated relative to the beginning of the underlying octets builder. This means that this builder must represent the message only. This means that if you are using the StreamTarget, you need to place it inside this type, not the other way around.

Implementations§

Source§

impl<Target> StaticCompressor<Target>

Source

pub fn new(target: Target) -> StaticCompressor<Target>

Creates a static compressor from an octets builder.

Source

pub fn as_target(&self) -> &Target

Returns a reference to the underlying octets builder.

Source

pub fn into_target(self) -> Target

Converts the static compressor into the underlying octets builder.

Source

pub fn as_slice(&self) -> &[u8]
where Target: AsRef<[u8]>,

Returns a reference to the octets slice of the content.

Source

pub fn as_slice_mut(&mut self) -> &mut [u8]
where Target: AsMut<[u8]>,

Returns a reference to the octets slice of the content.

Trait Implementations§

Source§

impl<Target> AsMut<[u8]> for StaticCompressor<Target>
where Target: AsMut<[u8]>,

Source§

fn as_mut(&mut self) -> &mut [u8]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<Target> AsRef<[u8]> for StaticCompressor<Target>
where Target: AsRef<[u8]>,

Source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<Target> Clone for StaticCompressor<Target>
where Target: Clone,

Source§

fn clone(&self) -> StaticCompressor<Target>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

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

Source§

fn append_compressed_name<N>( &mut self, name: &N, ) -> Result<(), <StaticCompressor<Target> as OctetsBuilder>::AppendError>
where N: ToName + ?Sized,

Appends a domain name using name compression if supported. Read more
Source§

fn can_compress(&self) -> bool

Source§

impl<Target> Debug for StaticCompressor<Target>
where Target: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<Target> FreezeBuilder for StaticCompressor<Target>
where Target: FreezeBuilder,

Source§

type Octets = <Target as FreezeBuilder>::Octets

The type of octets sequence to builder will be frozen into.
Source§

fn freeze(self) -> <StaticCompressor<Target> as FreezeBuilder>::Octets

Converts the octets builder into an immutable octets sequence.
Source§

impl<Target> OctetsBuilder for StaticCompressor<Target>
where Target: OctetsBuilder,

Source§

type AppendError = <Target as OctetsBuilder>::AppendError

The error type when appending data fails. Read more
Source§

fn append_slice( &mut self, slice: &[u8], ) -> Result<(), <StaticCompressor<Target> as OctetsBuilder>::AppendError>

Appends the content of a slice to the builder. Read more
Source§

impl<Target> Truncate for StaticCompressor<Target>
where Target: Truncate,

Source§

fn truncate(&mut self, len: usize)

Truncate the sequence to len octets. Read more

Auto Trait Implementations§

§

impl<Target> Freeze for StaticCompressor<Target>
where Target: Freeze,

§

impl<Target> RefUnwindSafe for StaticCompressor<Target>
where Target: RefUnwindSafe,

§

impl<Target> Send for StaticCompressor<Target>
where Target: Send,

§

impl<Target> Sync for StaticCompressor<Target>
where Target: Sync,

§

impl<Target> Unpin for StaticCompressor<Target>
where Target: Unpin,

§

impl<Target> UnsafeUnpin for StaticCompressor<Target>
where Target: UnsafeUnpin,

§

impl<Target> UnwindSafe for StaticCompressor<Target>
where Target: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Source, Target> OctetsInto<Target> for Source
where Target: OctetsFrom<Source>,

Source§

type Error = <Target as OctetsFrom<Source>>::Error

Source§

fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>

Performs the conversion.
Source§

fn octets_into(self) -> Target
where Self::Error: Into<Infallible>,

Performs an infallible conversion.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.