pub struct Message<'arrays, 'innards> { /* private fields */ }
Expand description

The message for a DNS query.

Implementations

Create a new message from a set of buffers for each section.

Panics

This function panics if the number of questions, answers, authorities, or additional records is greater than u16::MAX.

Get the ID of this message.

Get a mutable reference to the ID of this message.

Get the header of this message.

Get the flags for this message.

Get a mutable reference to the flags for this message.

Get the questions in this message.

Get a mutable reference to the questions in this message.

Get the answers in this message.

Get a mutable reference to the answers in this message.

Get the authorities in this message.

Get a mutable reference to the authorities in this message.

Get the additional records in this message.

Get a mutable reference to the additional records in this message.

Get the buffer space needed to serialize this message.

Write this message to a buffer.

Returns the number of bytes written.

Errors

This function may raise Error::NameTooLong if a Label is too long to be serialized.

Panics

This function panics if the buffer is not large enough to hold the serialized message. This panic can be avoided by ensuring the buffer contains at least [space_needed] bytes.

Read a message from a buffer.

Errors

This function may raise one of the following errors:

  • Error::NotEnoughReadBytes if the buffer is not large enough to hold the entire structure. You may need to read more data before calling this function again.
  • Error::NotEnoughWriteSpace if the buffers provided are not large enough to hold the entire structure. You may need to allocate larger buffers before calling this function.
  • Error::InvalidUtf8 if a domain name contains invalid UTF-8.
  • Error::NameTooLong if a domain name is too long to be deserialized.
  • Error::InvalidCode if a domain name contains an invalid label code.

Trait Implementations

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

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.

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.