Expand description
Utilities for the char
primitive type.
See also the char
primitive type.
The char
type represents a single character. More specifically, since
‘character’ isn’t a well-defined concept in Unicode, char
is a ‘Unicode
scalar value’, which is similar to, but not the same as, a ‘Unicode code
point’.
This module exists for technical reasons, the primary documentation for
char
is directly on the char
primitive type itself.
This module is the home of the iterator implementations for the iterators
implemented on char
, as well as some useful constants and conversion
functions that convert various types to char
.
Structs§
- Char
TryFrom Error - The error type returned when a conversion from
u32
tochar
fails. - Decode
Utf16 - An iterator that decodes UTF-16 encoded code points from an iterator of
u16
s. - Decode
Utf16 Error - An error that can be returned when decoding UTF-16 code points.
- Escape
Debug - An iterator that yields the literal escape code of a
char
. - Escape
Default - An iterator that yields the literal escape code of a
char
. - Escape
Unicode - Returns an iterator that yields the hexadecimal Unicode escape of a
character, as
char
s. - Parse
Char Error - An error which can be returned when parsing a char.
- ToLowercase
- Returns an iterator that yields the lowercase equivalent of a
char
. - ToUppercase
- Returns an iterator that yields the uppercase equivalent of a
char
. - TryFrom
Char Error - The error type returned when a checked char conversion fails.
Constants§
- MAX
- The highest valid code point a
char
can have,'\u{10FFFF}'
. Usechar::MAX
instead. - REPLACEMENT_
CHARACTER U+FFFD REPLACEMENT CHARACTER
(�) is used in Unicode to represent a decoding error. Usechar::REPLACEMENT_CHARACTER
instead.- UNICODE_
VERSION - The version of Unicode that the Unicode parts of
char
andstr
methods are based on. Usechar::UNICODE_VERSION
instead.
Functions§
- decode_
utf16 - Creates an iterator over the UTF-16 encoded code points in
iter
, returning unpaired surrogates asErr
s. Usechar::decode_utf16
instead. - from_
digit - Converts a digit in the given radix to a
char
. Usechar::from_digit
instead. - from_
u32 - Converts a
u32
to achar
. Usechar::from_u32
instead. - from_
u32_ ⚠unchecked - Converts a
u32
to achar
, ignoring validity. Usechar::from_u32_unchecked
instead.