Crate encode_unicode [] [src]

Alternatives and extensions to the unstable char.encode_utf8() and char.encode_utf16().

crates.io page github repository

Optional features:

  • no_std: Use #[no_std]; There are some differences:
    • AsciiExt doesn't exist, but is_ascii() is made available as an inherent impl.
    • Error doesn't exist, but description() is made available as an inherent impl.
    • There is no io, so Utf8Iterator doesn't implement Read.
    • The iterators doesn't implement Debug.
  • ascii: Convert Utf8Char and Utf16Char to and from ascii::AsciiChar.
  • ascii_no_std: You need to use this feature instead of both ascii and no_std. This is because the ascii crate needs to know about #[no_std], but the features are otherwize independent.

Modules

error

Errors returned by various conversion methods in this crate.

Structs

Utf16Char

Store a char as UTF-16 so it can be borrowed as a slice

Utf16Iterator

Iterate over the units in an UTF-16 representation of a codepoint.

Utf8Char

Store a char as UTF-8 so it can be borrowed as a str

Utf8Iterator

Read or iterate over the bytes in the UTF-8 representation of a codepoint.

Traits

CharExt

Extension trait for char that adds methods for converting to and from UTF-8 or UTF-16.

U16UtfExt

Methods for working with u16s as UTF-16 units.

U8UtfExt

Methods for working with u8s UTF-8.