Expand description
Character strings.
The somewhat ill-named <character-string> is defined in RFC 1035 as
binary information of up to 255 octets. As such, it doesn’t necessarily
contain (ASCII-) characters nor is it a string in a Rust-sense.
An existing, immutable character string is represented by the type
CharStr. The type CharStrMut allows constructing a character
string from individual octets or byte slices.
In wire-format, character strings are encoded as one octet giving the length followed by the actual data in that many octets. The length octet is not part of the content wrapped by these two types.
A CharStr can be constructed from a string slice via the FromStr
trait. In this case, the string must consist only of printable ASCII
characters. Space and double quote are allowed and will be accepted with
their ASCII value. Other values need to be escaped via a backslash
followed by the three-digit decimal representation of the value. In
addition, a backslash followed by a non-digit printable ASCII character
is accepted, too, with the ASCII value of this character used.
Structs§
- CharStr
- The content of a DNS character string.
- Char
StrError - A byte sequence does not represent a valid character string.
- Char
StrMut - A mutable DNS character string.
- Push
Error - An error happened while adding data to a
CharStrMut.
Enums§
- From
StrError - An error happened when converting a Rust string to a DNS character string.