Struct AnswerBuilder

Source
pub struct AnswerBuilder { /* private fields */ }
Expand description

Builds the answer section of a DNS message.

This type is typically constructed by calling answer on a MessageBuilder. See the module documentation for an overview of how to build a message.

Once acquired, you can access a message’s header or append resource records to the message’s answer section with the push method.

Implementations§

Source§

impl AnswerBuilder

Source

pub fn authority(self) -> AuthorityBuilder

Proceeds to building the authority section.

Source

pub fn additional(self) -> AdditionalBuilder

Proceeds to building the additional section, skipping authority.

Source

pub fn opt(self) -> Result<OptBuilder, ShortBuf>
where Self: Sized,

Proceeds to building the OPT record.

The method will start by adding the record header. Since this may exceed the message limit, the method may fail. If you have saved space for the OPT record via set_limit earlier, remember to increase the limit again before calling opt.

Trait Implementations§

Source§

impl Clone for AnswerBuilder

Source§

fn clone(&self) -> AnswerBuilder

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 Debug for AnswerBuilder

Source§

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

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

impl RecordSectionBuilder for AnswerBuilder

Source§

fn push<N, D, R>(&mut self, record: R) -> Result<(), ShortBuf>
where N: ToDname, D: RecordData, R: Into<Record<N, D>>,

Appends a new resource record to the section. Read more
Source§

impl SectionBuilder for AnswerBuilder

Source§

fn into_target(self) -> MessageTarget

Converts into target
Source§

fn get_target(&self) -> &MessageTarget

Returns message target
Source§

fn get_target_mut(&mut self) -> &mut MessageTarget

Returns message target
Source§

fn set_limit(&mut self, limit: usize)

Updates the message’s size limit. Read more
Source§

fn header(&self) -> &Header

Returns a reference to the messages header.
Source§

fn header_mut(&mut self) -> &mut Header

Returns a mutable reference to the messages header.
Source§

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

Returns a reference to the message assembled so far. Read more
Source§

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

Returns a reference to the slice preceeding the message. Read more
Source§

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

Returns a mutable reference to the slice preceeding the message.
Source§

fn finish(self) -> BytesMut

Finishes the message and returns the underlying bytes buffer. Read more
Source§

fn freeze(self) -> Message

Finishes the message and returns the resulting bytes value. Read more
Source§

fn snapshot(&self) -> Snapshot<Self>

Returns a snapshot indicating the current state of the message. Read more
Source§

fn rewind(&mut self, snapshot: &Snapshot<Self>)

Rewinds the message to the state it had at snapshot. Read more

Auto Trait Implementations§

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

Source§

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