pub struct MsgWriter<'a> { /* private fields */ }
Expand description
Writes a single DNS message as a series of bytes.
Implementations§
Source§impl<'a> MsgWriter<'a>
impl<'a> MsgWriter<'a>
Sourcepub fn new(data: &mut [u8]) -> MsgWriter<'_>
pub fn new(data: &mut [u8]) -> MsgWriter<'_>
Constructs a new message writer that will write into the given byte slice.
Sourcepub fn into_bytes(self) -> &'a [u8] ⓘ
pub fn into_bytes(self) -> &'a [u8] ⓘ
Returns a subslice of the wrapped byte slice that contains only the bytes written.
Sourcepub fn write(&mut self, data: &[u8]) -> Result<(), EncodeError>
pub fn write(&mut self, data: &[u8]) -> Result<(), EncodeError>
Writes a series of bytes to the message. Returns Err(TooLong)
if the
whole buffer cannot be written.
Sourcepub fn write_character_string(&mut self, data: &[u8]) -> Result<(), EncodeError>
pub fn write_character_string(&mut self, data: &[u8]) -> Result<(), EncodeError>
Write a character string, as defined by RFC 1035.
Sourcepub fn write_name(&mut self, name: &str) -> Result<(), EncodeError>
pub fn write_name(&mut self, name: &str) -> Result<(), EncodeError>
Writes a name to the message.
Sourcepub fn write_byte(&mut self, data: u8) -> Result<(), EncodeError>
pub fn write_byte(&mut self, data: u8) -> Result<(), EncodeError>
Writes a single byte to the message.
Auto Trait Implementations§
impl<'a> Freeze for MsgWriter<'a>
impl<'a> RefUnwindSafe for MsgWriter<'a>
impl<'a> Send for MsgWriter<'a>
impl<'a> Sync for MsgWriter<'a>
impl<'a> Unpin for MsgWriter<'a>
impl<'a> !UnwindSafe for MsgWriter<'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