[−][src]Struct domain_resolv::stub::Answer
The answer to a question.
This type is a wrapper around the DNS Message
containing the answer
that provides some additional information.
Implementations
impl Answer
[src]
pub fn is_final(&self) -> bool
[src]
Returns whether the answer is a final answer to be returned.
pub fn is_truncated(&self) -> bool
[src]
Returns whether the answer is truncated.
pub fn into_message(self) -> Message<Bytes>
[src]
Methods from Deref<Target = Message<Bytes>>
pub fn as_octets(&self) -> &Octets
[src]
Returns a reference to the underlying octets sequence.
pub fn as_slice(&self) -> &[u8] where
Octets: AsRef<[u8]>,
[src]
Octets: AsRef<[u8]>,
Returns a slice to the underlying octets sequence.
pub fn for_slice(&self) -> Message<&[u8]> where
Octets: AsRef<[u8]>,
[src]
Octets: AsRef<[u8]>,
Returns a message for a slice of the octets sequence.
pub fn header(&self) -> Header
[src]
Returns the message header.
pub fn header_counts(&self) -> HeaderCounts
[src]
Returns the header counts of the message.
pub fn header_section(&self) -> HeaderSection
[src]
Returns the entire header section.
pub fn no_error(&self) -> bool
[src]
Returns whether the rcode of the header is NoError.
pub fn is_error(&self) -> bool
[src]
Returns whether the rcode of the header is one of the error values.
pub fn question(&self) -> QuestionSection<&Octets>
[src]
Returns the question section.
pub fn zone(&self) -> QuestionSection<&Octets>
[src]
Returns the zone section of an UPDATE message.
This is identical to self.question()
.
pub fn answer(&self) -> Result<RecordSection<&Octets>, ParseError>
[src]
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.
pub fn prerequisite(&self) -> Result<RecordSection<&Octets>, ParseError>
[src]
Returns the prerequisite section of an UPDATE message.
This is identical to self.answer()
.
pub fn authority(&self) -> Result<RecordSection<&Octets>, ParseError>
[src]
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.
pub fn update(&self) -> Result<RecordSection<&Octets>, ParseError>
[src]
Returns the update section of an UPDATE message.
This is identical to self.authority()
.
pub fn additional(&self) -> Result<RecordSection<&Octets>, ParseError>
[src]
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.
pub fn sections(
&self
) -> Result<(QuestionSection<&Octets>, RecordSection<&Octets>, RecordSection<&Octets>, RecordSection<&Octets>), ParseError>
[src]
&self
) -> Result<(QuestionSection<&Octets>, RecordSection<&Octets>, RecordSection<&Octets>, RecordSection<&Octets>), ParseError>
Returns all four sections in one fell swoop.
pub fn iter(&self) -> MessageIter<&Octets>
[src]
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.
pub fn is_answer<Other>(&self, query: &Message<Other>) -> bool where
Other: AsRef<[u8]>,
&'o Other: for<'o> OctetsRef,
[src]
Other: AsRef<[u8]>,
&'o Other: for<'o> OctetsRef,
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.
pub fn first_question(&self) -> Option<Question<ParsedDname<&Octets>>>
[src]
Returns the first question, if there is any.
The method will return None
both if there are no questions or if
parsing fails.
pub fn sole_question(
&self
) -> Result<Question<ParsedDname<&Octets>>, ParseError>
[src]
&self
) -> Result<Question<ParsedDname<&Octets>>, ParseError>
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.
pub fn qtype(&self) -> Option<Rtype>
[src]
Returns the query type of the first question, if any.
pub fn contains_answer<'s, Data>(&'s self) -> bool where
Data: ParseRecordData<&'s Octets>,
[src]
Data: ParseRecordData<&'s Octets>,
Returns whether the message contains answers of a given type.
pub fn canonical_name(&self) -> Option<ParsedDname<&Octets>>
[src]
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
.
pub fn opt(&self) -> Option<OptRecord<<&Octets as OctetsRef>::Range>>
[src]
Returns the OPT record from the message, if there is one.
pub fn get_last_additional<'s, Data>(
&'s self
) -> Option<Record<ParsedDname<&'s Octets>, Data>> where
Data: ParseRecordData<&'s Octets>,
[src]
&'s self
) -> Option<Record<ParsedDname<&'s Octets>, Data>> where
Data: ParseRecordData<&'s Octets>,
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
.
pub fn copy_records<'s, R, F, T, O>(
&'s self,
target: T,
op: F
) -> Result<AdditionalBuilder<O>, CopyRecordsError> where
F: FnMut(ParsedRecord<&'s Octets>) -> Option<R>,
O: OctetsBuilder,
R: AsRecord + 's,
T: Into<AnswerBuilder<O>>,
&'a Octets: for<'a> OctetsRef,
[src]
&'s self,
target: T,
op: F
) -> Result<AdditionalBuilder<O>, CopyRecordsError> where
F: FnMut(ParsedRecord<&'s Octets>) -> Option<R>,
O: OctetsBuilder,
R: AsRecord + 's,
T: Into<AnswerBuilder<O>>,
&'a Octets: for<'a> OctetsRef,
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
impl AsRef<Message<Bytes>> for Answer
[src]
impl Clone for Answer
[src]
impl Deref for Answer
[src]
type Target = Message<Bytes>
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl From<Message<Bytes>> for Answer
[src]
Auto Trait Implementations
impl RefUnwindSafe for Answer
impl Send for Answer
impl Sync for Answer
impl Unpin for Answer
impl UnwindSafe for Answer
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,