[−][src]Struct encode_unicode::Utf16Char
Store a char as UTF-16 so it can be borrowed as a slice
Size is identical to char.
Cannot represent all 2^32-1 possible values, but can do all valid ones.
Methods
impl Utf16Char[src]
pub fn from_slice(src: &[u16]) -> Result<(Self, usize), InvalidUtf16Slice>[src]
Validate and store the first UTF-16 codepoint in the slice. Also return how many units were needed.
pub fn from_tuple(utf16: (u16, Option<u16>)) -> Result<Self, InvalidUtf16Tuple>[src]
Validate and store a UTF-16 pair as returned from char.to_utf16_tuple().
pub fn len(self) -> usize[src]
Returns 1 or 2.
There is no .is_emty() because it would always return false.
pub fn to_char(self) -> char[src]
Convert from UTF-16 to UTF-32
pub fn to_slice(self, dst: &mut [u16]) -> Option<usize>[src]
Write the internal representation to a slice,
and then returns the number of u16s written.
None is returned if the buffer is too small; then the buffer is left unmodified.
A buffer of length two is always large enough.
pub fn to_tuple(self) -> (u16, Option<u16>)[src]
The second u16 is used for surrogate pairs.
Trait Implementations
impl PartialEq<Utf16Char> for Utf16Char[src]
impl AsRef<[u16]> for Utf16Char[src]
impl IntoIterator for Utf16Char[src]
type Item = u16
The type of the elements being iterated over.
type IntoIter = Utf16Iterator
Which kind of iterator are we turning this into?
ⓘImportant traits for Utf16Iteratorfn into_iter(self) -> Utf16Iterator[src]
Iterate over the units.
impl Default for Utf16Char[src]
impl Ord for Utf16Char[src]
fn cmp(&self, rhs: &Self) -> Ordering[src]
fn max(self, other: Self) -> Self1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self1.21.0[src]
Compares and returns the minimum of two values. Read more
impl Clone for Utf16Char[src]
fn clone(&self) -> Utf16Char[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl From<char> for Utf16Char[src]
impl From<Utf16Char> for char[src]
impl From<Utf16Char> for Utf16Iterator[src]
impl Eq for Utf16Char[src]
impl Copy for Utf16Char[src]
impl PartialOrd<Utf16Char> for Utf16Char[src]
fn partial_cmp(&self, rhs: &Self) -> Option<Ordering>[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool1.0.0[src]
This method tests less than (for self and other) and is used by the < operator. Read more
#[must_use]
fn le(&self, other: &Rhs) -> bool1.0.0[src]
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
#[must_use]
fn gt(&self, other: &Rhs) -> bool1.0.0[src]
This method tests greater than (for self and other) and is used by the > operator. Read more
#[must_use]
fn ge(&self, other: &Rhs) -> bool1.0.0[src]
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
impl Debug for Utf16Char[src]
impl Hash for Utf16Char[src]
fn hash<H: Hasher>(&self, state: &mut H)[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher]. Read more
impl Deref for Utf16Char[src]
impl Borrow<[u16]> for Utf16Char[src]
Auto Trait Implementations
Blanket Implementations
impl<I> IntoIterator for I where
I: Iterator, [src]
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I[src]
impl<T> From for T[src]
impl<T, U> Into for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
impl<T, U> TryFrom for T where
T: From<U>, [src]
T: From<U>,
type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T> Borrow for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,