Struct wtf8_rs::CodePoint [−][src]
pub struct CodePoint { /* fields omitted */ }
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
impl CodePoint
[src]
impl CodePoint
[src]pub unsafe fn from_u32_unchecked(value: u32) -> CodePoint
[src]
Unsafely creates a new CodePoint
without checking the value.
Safety
Only safe if value
is less than or equal to 0x10FFFF.
pub fn from_u32(value: u32) -> Option<CodePoint>
[src]
Creates a new CodePoint
if the value is a valid code point.
Returns None
if value
is above 0x10FFFF.
pub fn from_char(value: char) -> CodePoint
[src]
Creates a new CodePoint
from a char
.
Since all Unicode scalar values are code points, this always succeeds.
pub fn to_u32(&self) -> u32
[src]
Returns the numeric value of the code point.
pub fn to_char(&self) -> Option<char>
[src]
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).
pub fn to_char_lossy(&self) -> char
[src]
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>,
[src]
Notable traits for DecodeUtf16<I>
impl<I> Iterator for DecodeUtf16<I> where
I: Iterator<Item = u16>, type Item = CodePoint;
I: Iterator<Item = u16>,
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>,
[src]
Notable traits for EncodeUtf16<I>
impl<I> Iterator for EncodeUtf16<I> where
I: Iterator<Item = CodePoint>, type Item = u16;
I: Iterator<Item = CodePoint>,
Encode potentially ill-formed UTF-16.
Trait Implementations
impl Clone for CodePoint
[src]
impl Clone for CodePoint
[src]fn clone(&self) -> CodePoint
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for CodePoint
[src]
impl Debug for CodePoint
[src]Format the code point as U+
followed by four to six hexadecimal digits.
Example: U+1F4A9
impl<'a> Extend<&'a CodePoint> for Wtf8Buf
[src]
impl<'a> Extend<&'a CodePoint> for Wtf8Buf
[src]fn extend<T: IntoIterator<Item = &'a CodePoint>>(&mut self, iter: T)
[src]
pub fn extend_one(&mut self, item: A)
[src]
pub fn extend_reserve(&mut self, additional: usize)
[src]
impl Extend<CodePoint> for Wtf8Buf
[src]
impl Extend<CodePoint> for Wtf8Buf
[src]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.
fn extend<T: IntoIterator<Item = CodePoint>>(&mut self, iter: T)
[src]
pub fn extend_one(&mut self, item: A)
[src]
pub fn extend_reserve(&mut self, additional: usize)
[src]
impl<'a> FromIterator<&'a CodePoint> for Wtf8Buf
[src]
impl<'a> FromIterator<&'a CodePoint> for Wtf8Buf
[src]fn from_iter<T: IntoIterator<Item = &'a CodePoint>>(iter: T) -> Wtf8Buf
[src]
impl FromIterator<CodePoint> for Wtf8Buf
[src]
impl FromIterator<CodePoint> for Wtf8Buf
[src]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.
fn from_iter<T: IntoIterator<Item = CodePoint>>(iter: T) -> Wtf8Buf
[src]
impl PartialOrd<CodePoint> for CodePoint
[src]
impl PartialOrd<CodePoint> for CodePoint
[src]impl StructuralEq for CodePoint
[src]
impl StructuralEq for CodePoint
[src]impl StructuralPartialEq for CodePoint
[src]
impl StructuralPartialEq for CodePoint
[src]Auto Trait Implementations
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
The resulting type after obtaining ownership.