pub struct Message<'a> {
pub header: Header,
pub question: Vec<Question>,
pub answer: Vec<Resource<'a>>,
pub authority: Vec<Resource<'a>>,
pub additional: Vec<Resource<'a>>,
}
Expand description
Represents a DNS message.
Fields§
§header: Header
Describes the content of the remainder of the message.
question: Vec<Question>
Carries the question of query type messages.
answer: Vec<Resource<'a>>
Resource records that answer the query
Resource records that point to an authoritative name server
additional: Vec<Resource<'a>>
Resource records that relate to the query, but are not strictly answers for the question.
Implementations§
Source§impl<'a> Message<'a>
impl<'a> Message<'a>
Sourcepub fn decode(data: &[u8]) -> Result<Message<'_>, DecodeError>
pub fn decode(data: &[u8]) -> Result<Message<'_>, DecodeError>
Decodes a message from a series of bytes.
Sourcepub fn encode<'buf>(
&self,
buf: &'buf mut [u8],
) -> Result<&'buf [u8], EncodeError>
pub fn encode<'buf>( &self, buf: &'buf mut [u8], ) -> Result<&'buf [u8], EncodeError>
Encodes a message to a series of bytes. On success, returns a subslice of the given buffer containing only the encoded message bytes.
Sourcepub fn get_error(&self) -> Result<(), DnsError>
pub fn get_error(&self) -> Result<(), DnsError>
Returns a DnsError
if the message response code is an error.
Sourcepub fn records(&self) -> RecordIter<'_> ⓘ
pub fn records(&self) -> RecordIter<'_> ⓘ
Returns an iterator over the records in this message.
Sourcepub fn into_records(self) -> RecordIntoIter<'a> ⓘ
pub fn into_records(self) -> RecordIntoIter<'a> ⓘ
Consumes the message and returns an iterator over its records.
Trait Implementations§
impl<'a> Eq for Message<'a>
impl<'a> StructuralPartialEq for Message<'a>
Auto Trait Implementations§
impl<'a> Freeze for Message<'a>
impl<'a> RefUnwindSafe for Message<'a>
impl<'a> Send for Message<'a>
impl<'a> Sync for Message<'a>
impl<'a> Unpin for Message<'a>
impl<'a> UnwindSafe for Message<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more