Module char

Module char 

1.0.0 · Source
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§

CharTryFromError
The error type returned when a conversion from u32 to char fails.
DecodeUtf16
An iterator that decodes UTF-16 encoded code points from an iterator of u16s.
DecodeUtf16Error
An error that can be returned when decoding UTF-16 code points.
EscapeDebugNon-ferrocene_certified
An iterator that yields the literal escape code of a char.
EscapeDefaultNon-ferrocene_certified
An iterator that yields the literal escape code of a char.
EscapeUnicodeNon-ferrocene_certified
Returns an iterator that yields the hexadecimal Unicode escape of a character, as chars.
ParseCharErrorNon-ferrocene_certified
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.
TryFromCharErrorNon-ferrocene_certified
The error type returned when a checked char conversion fails.

Constants§

MAXNon-ferrocene_certified
The highest valid code point a char can have, '\u{10FFFF}'. Use char::MAX instead.
REPLACEMENT_CHARACTERNon-ferrocene_certified
U+FFFD REPLACEMENT CHARACTER (�) is used in Unicode to represent a decoding error. Use char::REPLACEMENT_CHARACTER instead.
UNICODE_VERSIONNon-ferrocene_certified
The version of Unicode that the Unicode parts of char and str methods are based on. Use char::UNICODE_VERSION instead.
MAX_LEN_UTF8ExperimentalNon-ferrocene_certified
The maximum number of bytes required to encode a char to UTF-8 encoding.
MAX_LEN_UTF16ExperimentalNon-ferrocene_certified
The maximum number of two-byte units required to encode a char to UTF-16 encoding.

Functions§

decode_utf16Non-ferrocene_certified
Creates an iterator over the UTF-16 encoded code points in iter, returning unpaired surrogates as Errs. Use char::decode_utf16 instead.
from_digitNon-ferrocene_certified
Converts a digit in the given radix to a char. Use char::from_digit instead.
from_u32Non-ferrocene_certified
Converts a u32 to a char. Use char::from_u32 instead.
from_u32_uncheckedNon-ferrocene_certified
Converts a u32 to a char, ignoring validity. Use char::from_u32_unchecked instead.