Struct wtf8::CodePoint
[−]
[src]
pub struct CodePoint { /* fields omitted */ }
A Unicode code point: from U+0000 to U+10FFFF.
Compare with the char
type,
which represents a Unicode scalar value:
a code point that is not a surrogate (U+D800 to U+DFFF).
Methods
impl CodePoint
[src]
unsafe fn from_u32_unchecked(value: u32) -> CodePoint
Unsafely create a new CodePoint
without checking the value.
Only use when value
is known to be less than or equal to 0x10FFFF.
fn from_u32(value: u32) -> Option<CodePoint>
Create a new CodePoint
if the value is a valid code point.
Return None
if value
is above 0x10FFFF.
fn from_char(value: char) -> CodePoint
Create a new CodePoint
from a char
.
Since all Unicode scalar values are code points, this always succeds.
fn to_u32(&self) -> u32
Return the numeric value of the code point.
fn to_char(&self) -> Option<char>
Optionally return a Unicode scalar value for the code point.
Return None
if the code point is a surrogate (from U+D800 to U+DFFF).
fn to_char_lossy(&self) -> char
Return a Unicode scalar value for the code point.
Return '\u{FFFD}'
(the replacement character “�”)
if the code point is a surrogate (from U+D800 to U+DFFF).
Trait Implementations
impl Eq for CodePoint
[src]
impl PartialEq for CodePoint
[src]
fn eq(&self, __arg_0: &CodePoint) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &CodePoint) -> bool
This method tests for !=
.
impl Ord for CodePoint
[src]
fn cmp(&self, __arg_0: &CodePoint) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl PartialOrd for CodePoint
[src]
fn partial_cmp(&self, __arg_0: &CodePoint) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &CodePoint) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &CodePoint) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &CodePoint) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &CodePoint) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Clone for CodePoint
[src]
fn clone(&self) -> CodePoint
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Copy for CodePoint
[src]
impl Debug for CodePoint
[src]
Format the code point as U+
followed by four to six hexadecimal digits.
Example: U+1F4A9
fn fmt(&self, formatter: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter.