Struct domain::base::opt::padding::Padding

source ·
pub struct Padding<Octs: ?Sized> { /* private fields */ }
Expand description

Option data for the padding option.

This option is used to increase the size of a DNS message to a fixed value so eavesdropper can’t dertermine information from the size.

Generally, you should not need to use this type. Instead, you can use the OptBuilder::padding and OptBuilder::random_padding methods to add padding to a message – and ignore it when receving one.

The option is defined in RFC 7830.

Implementations§

source§

impl<Octs> Padding<Octs>

source

pub fn from_octets(octets: Octs) -> Result<Self, LongOptData>
where Octs: AsRef<[u8]>,

Creates a value from the padding octets.

Returns an error if octets are longer than 65,535 octets.

source

pub unsafe fn from_octets_unchecked(octets: Octs) -> Self

Creates a value from the padding octets without checking.

§Safety

The caller needs to ensure that octets are not longer than 65,535 octets.

source

pub fn parse<'a, Src: Octets<Range<'a> = Octs> + ?Sized>( parser: &mut Parser<'a, Src>, ) -> Result<Self, ParseError>

Parses a value from its wire formal.

source§

impl<Octs: ?Sized> Padding<Octs>

source

pub fn as_octets(&self) -> &Octs

Returns a reference to the padding octets.

source

pub fn into_octets(self) -> Octs
where Octs: Sized,

Converts the value into the padding octets.

source

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

Returns a slice of the padding octets.

Trait Implementations§

source§

impl<Octs: AsRef<[u8]> + ?Sized> AsRef<[u8]> for Padding<Octs>

source§

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

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

impl<Octs: AsRef<[u8]> + ?Sized> Borrow<[u8]> for Padding<Octs>

source§

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

Immutably borrows from an owned value. Read more
source§

impl<Octs: Clone + ?Sized> Clone for Padding<Octs>

source§

fn clone(&self) -> Padding<Octs>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<Octs: AsRef<[u8]>> ComposeOptData for Padding<Octs>

source§

fn compose_len(&self) -> u16

source§

fn compose_option<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>

source§

impl<Octs: AsRef<[u8]> + ?Sized> Debug for Padding<Octs>

source§

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

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

impl<Octs: AsRef<[u8]> + ?Sized> Display for Padding<Octs>

source§

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

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

impl<Octs, Name> From<Padding<Octs>> for AllOptData<Octs, Name>

source§

fn from(value: Padding<Octs>) -> Self

Converts to this type from the input type.
source§

impl<Octs> OptData for Padding<Octs>

source§

fn code(&self) -> OptionCode

Returns the option code associated with this option.
source§

impl<'a, Octs: Octets> ParseOptData<'a, Octs> for Padding<Octs::Range<'a>>

source§

fn parse_option( code: OptionCode, parser: &mut Parser<'a, Octs>, ) -> Result<Option<Self>, ParseError>

Parses the option code data. Read more
source§

impl<Octs: Copy + ?Sized> Copy for Padding<Octs>

Auto Trait Implementations§

§

impl<Octs> Freeze for Padding<Octs>
where Octs: Freeze + ?Sized,

§

impl<Octs> RefUnwindSafe for Padding<Octs>
where Octs: RefUnwindSafe + ?Sized,

§

impl<Octs> Send for Padding<Octs>
where Octs: Send + ?Sized,

§

impl<Octs> Sync for Padding<Octs>
where Octs: Sync + ?Sized,

§

impl<Octs> Unpin for Padding<Octs>
where Octs: Unpin + ?Sized,

§

impl<Octs> UnwindSafe for Padding<Octs>
where Octs: UnwindSafe + ?Sized,

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§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

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

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

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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>,

§

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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>,

§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V