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]

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]

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]

Encode potentially ill-formed UTF-16.

Trait Implementations

impl Clone for CodePoint[src]

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

impl Eq for CodePoint[src]

impl<'a> Extend<&'a 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.

impl From<char> for CodePoint[src]

impl<'a> FromIterator<&'a 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.

impl Ord for CodePoint[src]

impl PartialEq<CodePoint> for CodePoint[src]

impl PartialOrd<CodePoint> for CodePoint[src]

impl StructuralEq for CodePoint[src]

impl StructuralPartialEq for CodePoint[src]

Auto Trait Implementations

impl Send for CodePoint

impl Sync for CodePoint

impl Unpin for CodePoint

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.