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

Builds the question section of a DNS message.

A value of this type can be acquired by calling the question method on any other builder type. See the module documentation for an overview of how to build a message.

You can push questions to the end of the question section via the push method. It accepts various things that represent a question: question values and references; tuples of a domain name, record type, and class; and, using the regular class of IN, a pair of just a domain name and record type.

Once you are finished building the question section, you can progress to the answer section via the answer method or finish the message via finish. Additionally, conversions to all other builder types are available as well.

Implementations

Appends a question to the question section.

This method accepts anything that implements the AsQuestion trait. Apart from an actual Question or a reference to it, this can also be a tuple of a domain name, record type, and class or, if the class is the usual IN, a pair of just the name and type.

In other words, the options are:

use domain::base::{Dname, MessageBuilder, Question, Rtype};
use domain::base::iana::Class;

let mut msg = MessageBuilder::new_vec().question();
msg.push(Question::new_in(Dname::root_ref(), Rtype::A)).unwrap();
msg.push(&Question::new_in(Dname::root_ref(), Rtype::A)).unwrap();
msg.push((Dname::root_ref(), Rtype::A, Class::In)).unwrap();
msg.push((Dname::root_ref(), Rtype::A)).unwrap();

Conversions

Additional conversion are available via the Deref implementation.

Rewinds to an empty question section.

All previously added questions will be lost.

Converts the question builder into a message builder.

All questions will be dropped and the question section will be empty.

Converts the question builder into a question builder.

In other words, doesn’t do anything.

Converts the question builder into an answer builder.

Converts the question builder into an authority builder.

This will leave the answer section empty.

Converts the question builder into an additional builder.

This will leave the answer and authority sections empty.

Converts the question builder into the underlying octets builder.

This will leave the answer, authority, and additional sections empty.

Converts the question builder into the final message.

The method will return a message atop whatever octets sequence the builder’s octets builder converts into.

Returns a reference to the underlying message builder.

Returns a mutable reference to the underlying message builder.

Methods from Deref<Target = MessageBuilder<Target>>

Return the current value of the message header.

Return the current value of the message header counts.

Returns a mutable reference to the message header for manipulations.

Returns a reference to the underlying octets builder.

Returns an octets slice of the octets assembled so far.

Returns a message atop for the octets assembled so far.

This message is atop the octets slices derived from the builder, so it can be created cheaply.

Trait Implementations

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

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

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

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Available on crate feature tsig only.

The representation of the key returned by the store.

Available on crate feature tsig only.

Tries to find a key in the store. Read more

Performs the conversion.

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.