pub struct Answer { /* private fields */ }
Available on crate feature resolv only.
Expand description

The answer to a question.

This type is a wrapper around the DNS Message containing the answer that provides some additional information.

Implementations

Returns whether the answer is a final answer to be returned.

Returns whether the answer is truncated.

Methods from Deref<Target = Message<Bytes>>

Returns a reference to the underlying octets sequence.

Returns a slice to the underlying octets sequence.

Returns a message for a slice of the octets sequence.

Returns the message header.

Returns the header counts of the message.

Returns the entire header section.

Returns whether the rcode of the header is NoError.

Returns whether the rcode of the header is one of the error values.

Returns the question section.

Returns the zone section of an UPDATE message.

This is identical to self.question().

Returns the answer section.

Iterates over the question section in order to access the answer section. If you are accessing the question section anyway, using its next_section method may be more efficient.

Returns the prerequisite section of an UPDATE message.

This is identical to self.answer().

Returns the authority section.

Iterates over both the question and the answer sections to determine the start of the authority section. If you are already accessing the answer section, using next_section on it is more efficient.

Returns the update section of an UPDATE message.

This is identical to self.authority().

Returns the additional section.

Iterates over all three previous sections to determine the start of the additional section. If you are already accessing the authority section, using next_section on it is more efficient.

Returns all four sections in one fell swoop.

Returns an iterator over the records in the message.

The iterator’s item is a pair of a ParsedRecord and the Section it was found in.

As is customary, this iterator is also accessible via the IntoIterator trait on a reference to the message.

Returns whether this is the answer to some other message.

The method checks whether the ID fields of the headers are the same, whether the QR flag is set in this message, and whether the questions are the same.

Returns the first question, if there is any.

The method will return None both if there are no questions or if parsing fails.

Returns the sole question of the message.

This is like first_question but returns an error if there isn’t exactly one question or there is a parse error.

Returns the query type of the first question, if any.

Returns whether the message contains answers of a given type.

Resolves the canonical name of the answer.

The CNAME record allows a domain name to be an alias for a different name. Aliases may be chained. The ‘canonical name’ referred to be the method’s name is the last name in this chain. A recursive resolver will support a stub resolver in figuring out this canonical name by including all necessary CNAME records in its answer. This method can be used on such an answer to determine the canonical name. As such, it will only consider CNAMEs present in the message’s answer section.

It starts with the question name and follows CNAME records until there is no next CNAME in the chain and then returns the last CNAME.

If the message doesn’t have a question, if there is a parse error, or if there is a CNAME loop the method returns None.

Returns the OPT record from the message, if there is one.

Returns the last additional record from the message.

The method tries to parse the last record of the additional section as the provided record type. If that succeeds, it returns that parsed record.

If the last record is of the wrong type or parsing fails, returns None.

Copy records from a message into the target message builder.

The method uses op to process records from all record sections before inserting, caller can use this closure to filter or manipulate records before inserting.

Trait Implementations

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

The resulting type after dereferencing.

Dereferences the value.

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.

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.