Struct domain::bits::message_builder::MessageBuilder[][src]

pub struct MessageBuilder { /* fields omitted */ }

A type for building the question section of a DNS message.

This type starts building a DNS message and allows adding questions to its question section. See the module documentation for details.

Methods

impl MessageBuilder
[src]

Creates a new empty DNS message.

The mode argument decides whether the message will have a size limit and whether it should include the length prefix for use with stream transports. If compress is true, name compression will be enabled for the message.

This function may fail if the size limit in mode is too small to even add the header section.

Creates a new DNS message appended to the content of a bytes vector.

The mode argument decides whether the message will have a size limit and whether it should include the length prefix for use with stream transports. If compress is true, name compression will be enabled for the message.

This function may fail if the size limit in mode is too small to even add the header section.

Creates a new DNS message atop an existing composer.

This doesn’t reset the composer but starts off after whatever is in there already. As this may result in invalid message, user discretion is advised.

impl MessageBuilder
[src]

Returns a reference to the message’s header.

Returns a mutable reference to the message’s header.

Appends a new question to the message.

This function is generic over anything that can be converted into a Question. In particular, triples of a domain name, a record type, and a class as well as pairs of just a domain name and a record type fulfill this requirement with the class assumed to be Class::In in the latter case.

Rewinds to the beginning of the question section.

This drops all previously assembled questions.

Proceeds to building the answer section.

Proceeds to building the authority section, skipping the answer.

Proceeds to building the additonal section.

Leaves the answer and additional sections empty.

Returns a reference to the message assembled so far.

This method requires a &mut self since it may need to update some length values to return a valid message.

In case the builder was created from a vector with previous content, the returned reference is for the full content of this vector.

Finishes the message and returns the underlying target.

This will result in a message with all three record sections empty.

Trait Implementations

impl Clone for MessageBuilder
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for MessageBuilder
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations