pub struct Characters<'a> { /* private fields */ }Expand description
A DNS message characters. It is a sequence of characters, where the first byte is the length of the sequence.
Implementations§
Source§impl<'a> Characters<'a>
impl<'a> Characters<'a>
Sourcepub const fn new(bytes: &'a [u8]) -> Result<Self, DnsMessageError>
pub const fn new(bytes: &'a [u8]) -> Result<Self, DnsMessageError>
Create a new Characters from a byte slice. The first byte of the
slice must be the length of the sequence. The maximum length of the
sequence is checked and 255, the first byte, must be equal to the length
of the slice minus 1, which is also checked. Use this function if you
want to create a Characters from a byte slice of unknown length.
If you know the length of the slice at compile time, use the
dns_characters! macro instead.
Sourcepub const unsafe fn new_unchecked(bytes: &'a [u8]) -> Self
pub const unsafe fn new_unchecked(bytes: &'a [u8]) -> Self
Create a new Characters from a byte slice. The first byte of the
slice must be the length of the sequence. The maximum length of the
sequence is not checked and 255, the first byte, must be equal to the
length of the slice minus 1, which is also not checked, hence the
unsafe. Using this function is unsafe cause it can lead to an invalid
DNS message.
Trait Implementations§
Source§impl<'a> AsRef<[u8]> for Characters<'a>
impl<'a> AsRef<[u8]> for Characters<'a>
Source§impl<'a> Clone for Characters<'a>
impl<'a> Clone for Characters<'a>
Source§fn clone(&self) -> Characters<'a>
fn clone(&self) -> Characters<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more