Module domain::bits::charstr[][src]

Character strings.

The somewhat ill-named <character-string> is defined in RFC 1035 as binary information of up to 255 bytes. As such, it doesn’t necessarily contain (ASCII-) characters nor is it a string in the Rust-sense. Character string are encoded as one octet giving the length followed by the actual data in that many octets.

The type CharStr defined in this module wraps a bytes slice making sure it always adheres to the length limit. It is an unsized type and is typically used as a reference. Its owned companion is CharStrBuf.

When defining types that contain character strings, it is best to make them generic over AsRef<CharStr> so that they can be used both with &'a CharStr for borrowed data and CharStrBuf for owned data.

Structs

CharStr

A slice of a DNS character string.

CharStrBuf

An owned, mutable DNS character string.

PushError

An error happened while adding data to a CharStrBuf.

Enums

FromStrError

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