[−][src]Struct resolve::message::MsgReader
Reads a single DNS message from a series of bytes.
Methods
impl<'a> MsgReader<'a>
[src]
[−]
impl<'a> MsgReader<'a>
pub fn new(data: &[u8]) -> MsgReader
[src]
[−]
pub fn new(data: &[u8]) -> MsgReader
Constructs a new message reader.
pub fn with_offset(data: &[u8], offset: usize) -> MsgReader
[src]
[−]
pub fn with_offset(data: &[u8], offset: usize) -> MsgReader
Constructs a new message reader, which will read from data
,
beginning at offset
.
pub fn remaining(&self) -> usize
[src]
[−]
pub fn remaining(&self) -> usize
Returns the number of bytes remaining in the message.
pub fn read(&mut self, buf: &mut [u8]) -> Result<(), DecodeError>
[src]
[−]
pub fn read(&mut self, buf: &mut [u8]) -> Result<(), DecodeError>
Reads a number of bytes equal to the length of the given buffer.
Returns Err(ShortMessage)
if there are not enough bytes remaining.
pub fn read_byte(&mut self) -> Result<u8, DecodeError>
[src]
[−]
pub fn read_byte(&mut self) -> Result<u8, DecodeError>
Reads a single byte from the message.
pub fn read_to_end(&mut self) -> Result<Vec<u8>, DecodeError>
[src]
[−]
pub fn read_to_end(&mut self) -> Result<Vec<u8>, DecodeError>
Reads all remaining bytes.
pub fn read_character_string(&mut self) -> Result<Vec<u8>, DecodeError>
[src]
[−]
pub fn read_character_string(&mut self) -> Result<Vec<u8>, DecodeError>
Read a character-string.
According to RFC 1035:
<character-string> is a single length octet followed by that number of characters. <character-string> is treated as binary information, and can be up to 256 characters in length (including the length octet).
pub fn read_u16(&mut self) -> Result<u16, DecodeError>
[src]
[−]
pub fn read_u16(&mut self) -> Result<u16, DecodeError>
Reads a big-endian unsigned 16 bit integer.
pub fn read_u32(&mut self) -> Result<u32, DecodeError>
[src]
[−]
pub fn read_u32(&mut self) -> Result<u32, DecodeError>
Reads a big-endian unsigned 32 bit integer.
pub fn read_into(
&mut self,
buf: &mut Vec<u8>,
n: usize
) -> Result<(), DecodeError>
[src]
[−]
pub fn read_into(
&mut self,
buf: &mut Vec<u8>,
n: usize
) -> Result<(), DecodeError>
Reads n
bytes, which are inserted at the end of the given buffer.
pub fn read_name(&mut self) -> Result<String, DecodeError>
[src]
[−]
pub fn read_name(&mut self) -> Result<String, DecodeError>
Reads a name from the message.
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
[−]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
[−]
impl<T, U> Into for T where
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
[−]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
[−]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
[−]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
[−]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
[−]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
[−]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
[−]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
[−]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
[−]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more