Module domain::base::charstr

source ·
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 CharStrBuilder allows constructing a character string from individual octets or octets 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 CharStr, it contains the data only.

A CharStr can be constructed from a string 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§

  • The content of a DNS character string.
  • A builder for a character string.
  • A byte sequence does not represent a valid character string.
  • The iterator type for IntoIterator for a character string itself.
  • The iterator type for IntoIterator for a reference to a character string.

Enums§

  • An error happened when converting a Rust string to a DNS character string.