Module redox::char [] [src]

A Unicode scalar value

This module provides the CharExt trait, as well as its implementation for the primitive char type, in order to allow basic character manipulation.

A char represents a Unicode scalar value, as it can contain any Unicode code point except high-surrogate and low-surrogate code points.

As such, only values in the ranges [0x0,0xD7FF] and [0xE000,0x10FFFF] (inclusive) are allowed. A char can always be safely cast to a u32; however the converse is not always true due to the above range limits and, as such, should be performed via the from_u32 function.

See also the char primitive type.

Structs

EscapeDefault

An iterator over the characters that represent a char, escaped for maximum portability.

EscapeUnicode

An iterator over the characters that represent a char, as escaped by Rust's unicode escaping rules.

ToLowercase

An iterator over the lowercase mapping of a given character, returned from the to_lowercase method on characters.

ToUppercase

An iterator over the uppercase mapping of a given character, returned from the to_uppercase method on characters.

DecodeUtf16 [Unstable]

An iterator that decodes UTF-16 encoded code points from an iterator of u16s.

Constants

MAX

The highest valid code point

REPLACEMENT_CHARACTER [Unstable]

U+FFFD REPLACEMENT CHARACTER (�) is used in Unicode to represent a decoding error. It can occur, for example, when giving ill-formed UTF-8 bytes to String::from_utf8_lossy.

UNICODE_VERSION [Unstable]

The version of Unicode that the unicode parts of CharExt and UnicodeStrPrelude traits are based on.

Functions

from_digit

Converts a number to the character representing it.

from_u32

Converts a u32 to an Option<char>.

from_u32_unchecked

Converts a u32 to an char, not checking whether it is a valid unicode codepoint.

decode_utf16 [Unstable]

Create an iterator over the UTF-16 encoded code points in iterable, returning unpaired surrogates as Errs.