pub struct Char16(/* private fields */);Expand description
A 16-bit unicode scalar value, limited to the Basic Multilingual Plane subset.
It can represent every scalar from the Basic Multilingual Plane (BMP), the first and most important plane in the Unicode standard (also known as plane 0), containing nearly all commonly used writing systems and symbols.
Option<Char16> is the same size as Char16 (2 bytes).
Implementations§
Source§impl Char16
impl Char16
Source§impl Char16
impl Char16
Sourcepub const MAX: Char16
pub const MAX: Char16
The highest unicode scalar a Char16 can represent, '\u{FFFF}'.
Note that '\u{FFFF}' is a noncharacter.
Sourcepub const REPLACEMENT_CHARACTER: Char16
pub const REPLACEMENT_CHARACTER: Char16
U+FFFD REPLACEMENT CHARACTER (�) is used in Unicode to represent a decoding error.
Sourcepub const fn from_char7(c: Char7) -> Char16
pub const fn from_char7(c: Char7) -> Char16
Converts a Char7 to Char16.
Sourcepub const fn from_char8(c: Char8) -> Char16
pub const fn from_char8(c: Char8) -> Char16
Converts a Char8 to Char16.
Sourcepub const fn try_from_char24(c: Char24) -> Result<Char16>
pub const fn try_from_char24(c: Char24) -> Result<Char16>
Tries to convert a Char24 to Char16.
Sourcepub const fn try_from_char32(c: Char32) -> Result<Char16>
pub const fn try_from_char32(c: Char32) -> Result<Char16>
Tries to convert a Char32 to Char16.
Sourcepub const fn try_from_char(c: char) -> Result<Char16>
pub const fn try_from_char(c: char) -> Result<Char16>
Tries to convert a char to Char16.
Sourcepub const fn try_to_char7(self) -> Result<Char7>
pub const fn try_to_char7(self) -> Result<Char7>
Tries to convert this Char16 to Char7.
Sourcepub const fn try_to_char8(self) -> Result<Char8>
pub const fn try_to_char8(self) -> Result<Char8>
Tries to convert this Char16 to Char8.
Sourcepub const fn to_utf8_bytes(self) -> [u8; 3]
pub const fn to_utf8_bytes(self) -> [u8; 3]
Converts this Char16 to an UTF-8 encoded sequence of bytes.
Note that this function always returns a 3-byte array, but the actual UTF-8 sequence may be shorter. The unused bytes are set to 0.
Sourcepub const fn to_ascii_uppercase(self) -> Char16
pub const fn to_ascii_uppercase(self) -> Char16
Makes a copy of the value in its ASCII upper case equivalent.
ASCII letters ‘a’ to ‘z’ are mapped to ‘A’ to ‘Z’, but non-ASCII letters are unchanged.
Sourcepub const fn to_ascii_lowercase(self) -> Char16
pub const fn to_ascii_lowercase(self) -> Char16
Makes a copy of the value in its ASCII lower case equivalent.
ASCII letters ‘A’ to ‘Z’ are mapped to ‘a’ to ‘z’, but non-ASCII letters are unchanged.
Sourcepub const fn is_noncharacter(self) -> bool
pub const fn is_noncharacter(self) -> bool
Returns true if this unicode scalar is a noncharacter.
Sourcepub const fn is_character(self) -> bool
pub const fn is_character(self) -> bool
Returns true if this unicode scalar is an abstract character.
Trait Implementations§
Source§impl Chars for Char16
impl Chars for Char16
Source§fn encode_utf8(self, dst: &mut [u8]) -> &mut str
fn encode_utf8(self, dst: &mut [u8]) -> &mut str
Source§fn to_utf8_bytes(self) -> [u8; 4]
fn to_utf8_bytes(self) -> [u8; 4]
scalar to an UTF-8 encoded sequence of bytes. Read moreSource§fn encode_utf16(self, dst: &mut [u16]) -> &mut [u16]
fn encode_utf16(self, dst: &mut [u16]) -> &mut [u16]
Source§fn to_digit(self, radix: u32) -> Option<u32>
fn to_digit(self, radix: u32) -> Option<u32>
Source§fn to_ascii_uppercase(self) -> Self
fn to_ascii_uppercase(self) -> Self
Source§fn to_ascii_lowercase(self) -> Self
fn to_ascii_lowercase(self) -> Self
Source§fn is_noncharacter(self) -> bool
fn is_noncharacter(self) -> bool
true if this unicode scalar is a noncharacter.Source§fn is_digit(self, radix: u32) -> bool
fn is_digit(self, radix: u32) -> bool
Source§fn is_control(self) -> bool
fn is_control(self) -> bool
true if this unicode scalar has the general category for
control codes.Source§fn is_alphabetic(self) -> bool
fn is_alphabetic(self) -> bool
true if this unicode scalar has the Alphabetic property.Source§fn is_numeric(self) -> bool
fn is_numeric(self) -> bool
true if this unicode scalar has one of the general categories
for numbers. Read moreSource§fn is_alphanumeric(self) -> bool
fn is_alphanumeric(self) -> bool
Source§fn is_lowercase(self) -> bool
fn is_lowercase(self) -> bool
true if this unicode scalar has the Lowercase property.Source§fn is_uppercase(self) -> bool
fn is_uppercase(self) -> bool
true if this unicode scalar has the Lowercase property.Source§fn is_whitespace(self) -> bool
fn is_whitespace(self) -> bool
true if this unicode scalar has the White_Space property.Source§fn is_character(self) -> boolwhere
Self: Sized,
fn is_character(self) -> boolwhere
Self: Sized,
true if this unicode scalar is an abstract character.