Struct wtf8_rs::codepoint::CodePoint [−][src]
pub struct CodePoint { /* fields omitted */ }
Expand description
A Unicode code point: from U+0000 to U+10FFFF.
Compares with the char
type,
which represents a Unicode scalar value:
a code point that is not a surrogate (U+D800 to U+DFFF).
Implementations
Unsafely creates a new CodePoint
without checking the value.
Safety
Only safe if value
is less than or equal to 0x10FFFF.
Creates a new CodePoint
if the value is a valid code point.
Returns None
if value
is above 0x10FFFF.
Creates a new CodePoint
from a char
.
Since all Unicode scalar values are code points, this always succeeds.
Optionally returns a Unicode scalar value for the code point.
Returns None
if the code point is a surrogate (from U+D800 to U+DFFF).
Returns a Unicode scalar value for the code point.
Returns '\u{FFFD}'
(the replacement character “�”)
if the code point is a surrogate (from U+D800 to U+DFFF).
pub fn decode_utf16<I>(input: I) -> DecodeUtf16<I>ⓘNotable traits for DecodeUtf16<I>impl<I> Iterator for DecodeUtf16<I> where
I: Iterator<Item = u16>, type Item = CodePoint;
where
I: Iterator<Item = u16>,
pub fn decode_utf16<I>(input: I) -> DecodeUtf16<I>ⓘNotable traits for DecodeUtf16<I>impl<I> Iterator for DecodeUtf16<I> where
I: Iterator<Item = u16>, type Item = CodePoint;
where
I: Iterator<Item = u16>,
impl<I> Iterator for DecodeUtf16<I> where
I: Iterator<Item = u16>, type Item = CodePoint;
Decode potentially ill-formed UTF-16.
pub fn encode_utf16<I>(input: I) -> EncodeUtf16<I>ⓘNotable traits for EncodeUtf16<I>impl<I> Iterator for EncodeUtf16<I> where
I: Iterator<Item = CodePoint>, type Item = u16;
where
I: Iterator<Item = CodePoint>,
pub fn encode_utf16<I>(input: I) -> EncodeUtf16<I>ⓘNotable traits for EncodeUtf16<I>impl<I> Iterator for EncodeUtf16<I> where
I: Iterator<Item = CodePoint>, type Item = u16;
where
I: Iterator<Item = CodePoint>,
impl<I> Iterator for EncodeUtf16<I> where
I: Iterator<Item = CodePoint>, type Item = u16;
Encode potentially ill-formed UTF-16.
Trait Implementations
Format the code point as U+
followed by four to six hexadecimal digits.
Example: U+1F4A9
Extends a collection with the contents of an iterator. Read more
extend_one
)Extends a collection with exactly one element.
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Append code points from an iterator to the string.
This replaces surrogate code point pairs with supplementary code points, like concatenating ill-formed UTF-16 strings effectively would.
Extends a collection with the contents of an iterator. Read more
extend_one
)Extends a collection with exactly one element.
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Creates a new WTF-8 string from an iterator of code points.
This replaces surrogate code point pairs with supplementary code points, like concatenating ill-formed UTF-16 strings effectively would.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for CodePoint
impl UnwindSafe for CodePoint
Blanket Implementations
Mutably borrows from an owned value. Read more