Module wtf8

Source
Expand description

Implementation of the WTF-8 encoding.

This library uses Rust’s type system to maintain well-formedness, like the String and &str types do for UTF-8.

Since WTF-8 must not be used for interchange, this library deliberately does not provide access to the underlying bytes of WTF-8 strings, nor can it decode WTF-8 from arbitrary bytes. WTF-8 strings can be obtained from UTF-8, UTF-16, or code points.

Structs§

CodePoint
A Unicode code point: from U+0000 to U+10FFFF.
EncodeWide
Generates a wide character sequence for potentially ill-formed UTF-16.
Wtf8
A borrowed slice of well-formed WTF-8 data.
Wtf8Buf
An owned, growable string of well-formed WTF-8 data.
Wtf8CodePoints
Iterator for the code points of a WTF-8 string.

Constants§

UTF8_REPLACEMENT_CHARACTER 🔒

Functions§

check_utf8_boundary
Verify that index is at the edge of either a valid UTF-8 codepoint (i.e. a codepoint that’s not a surrogate) or of the whole string.
decode_surrogate 🔒
decode_surrogate_pair 🔒
is_code_point_boundary
Copied from str::is_char_boundary
slice_error_fail
Copied from core::str::raw::slice_error_fail
slice_unchecked
Copied from core::str::raw::slice_unchecked