Skip to main content

Utf16Str

Struct Utf16Str 

Source
pub struct Utf16Str { /* private fields */ }
Expand description

A UTF-16 string slice consisting of UCS-2 code units.

Indexing this type is equivalent to indexing UTF-16 code units (not bytes), which are represented by u16.

Implementations§

Source§

impl Utf16Str

Source

pub fn len(&self) -> usize

Returns the number of UTF-16 code units representing the string.

Source

pub fn as_ptr(&self) -> *const u16

Source

pub fn as_mut_ptr(&mut self) -> *mut u16

Source

pub unsafe fn from_utf16_unchecked(raw: &[u16]) -> &Self

Source

pub unsafe fn from_utf16_unchecked_mut(raw: &mut [u16]) -> &mut Self

Source

pub fn code_units(&self) -> Iter<'_, u16>

Iterates the UTF-16 code units.

Source

pub fn chars(&self) -> Utf16Chars<'_>

Iterates the code points in the string.

Source

pub fn char_indices(&self) -> Utf16CharIndices<'_>

Iterates the indices and their code pointss in the string.

Source

pub fn get<I: SliceIndex<Utf16Str>>( &self, index: I, ) -> Option<&<I as SliceIndex<Utf16Str>>::Output>

Source

pub fn get_mut<I: SliceIndex<Utf16Str>>( &mut self, index: I, ) -> Option<&mut <I as SliceIndex<Utf16Str>>::Output>

Source

pub unsafe fn get_unchecked<I: SliceIndex<Utf16Str>>( &self, index: I, ) -> &<I as SliceIndex<Utf16Str>>::Output

Source

pub unsafe fn get_unchecked_mut<I: SliceIndex<Utf16Str>>( &mut self, index: I, ) -> &mut <I as SliceIndex<Utf16Str>>::Output

Source

pub fn is_empty(&self) -> bool

Source

pub fn to_owned(&self) -> Utf16String

Source

pub fn to_utf8(&self) -> String

Source

pub fn to_lowercase(&self) -> Utf16String

Source

pub fn to_uppercase(&self) -> Utf16String

Trait Implementations§

Source§

impl Debug for Utf16Str

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Utf16Str

Source§

impl Hash for Utf16Str

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
Source§

impl<I> Index<I> for Utf16Str
where I: SliceIndex<Utf16Str>,

Source§

type Output = <I as SliceIndex<Utf16Str>>::Output

The returned type after indexing.
Source§

fn index(&self, index: I) -> &I::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<usize> for Utf16Str

Source§

type Output = u16

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<I> IndexMut<I> for Utf16Str
where I: SliceIndex<Utf16Str>,

Source§

fn index_mut(&mut self, index: I) -> &mut I::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl PartialEq for Utf16Str

Source§

fn eq(&self, other: &Utf16Str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl SliceIndex<Utf16Str> for RangeFull

Source§

type Output = Utf16Str

Source§

fn get(self, slice: &Utf16Str) -> Option<&Self::Output>

Source§

fn get_mut(self, slice: &mut Utf16Str) -> Option<&mut Self::Output>

Source§

unsafe fn get_unchecked(self, slice: &Utf16Str) -> &Self::Output

Source§

unsafe fn get_unchecked_mut(self, slice: &mut Utf16Str) -> &mut Self::Output

Source§

fn index(self, slice: &Utf16Str) -> &Self::Output

Source§

fn index_mut(self, slice: &mut Utf16Str) -> &mut Self::Output

Source§

impl SliceIndex<Utf16Str> for Range<usize>

Source§

type Output = Utf16Str

Source§

fn get(self, slice: &Utf16Str) -> Option<&Self::Output>

Source§

fn get_mut(self, slice: &mut Utf16Str) -> Option<&mut Self::Output>

Source§

unsafe fn get_unchecked(self, slice: &Utf16Str) -> &Self::Output

Source§

unsafe fn get_unchecked_mut(self, slice: &mut Utf16Str) -> &mut Self::Output

Source§

fn index(self, slice: &Utf16Str) -> &Self::Output

Source§

fn index_mut(self, slice: &mut Utf16Str) -> &mut Self::Output

Source§

impl SliceIndex<Utf16Str> for RangeTo<usize>

Source§

type Output = Utf16Str

Source§

fn get(self, slice: &Utf16Str) -> Option<&Self::Output>

Source§

fn get_mut(self, slice: &mut Utf16Str) -> Option<&mut Self::Output>

Source§

unsafe fn get_unchecked(self, slice: &Utf16Str) -> &Self::Output

Source§

unsafe fn get_unchecked_mut(self, slice: &mut Utf16Str) -> &mut Self::Output

Source§

fn index(self, slice: &Utf16Str) -> &Self::Output

Source§

fn index_mut(self, slice: &mut Utf16Str) -> &mut Self::Output

Source§

impl SliceIndex<Utf16Str> for RangeFrom<usize>

Source§

type Output = Utf16Str

Source§

fn get(self, slice: &Utf16Str) -> Option<&Self::Output>

Source§

fn get_mut(self, slice: &mut Utf16Str) -> Option<&mut Self::Output>

Source§

unsafe fn get_unchecked(self, slice: &Utf16Str) -> &Self::Output

Source§

unsafe fn get_unchecked_mut(self, slice: &mut Utf16Str) -> &mut Self::Output

Source§

fn index(self, slice: &Utf16Str) -> &Self::Output

Source§

fn index_mut(self, slice: &mut Utf16Str) -> &mut Self::Output

Source§

impl SliceIndex<Utf16Str> for RangeInclusive<usize>

Source§

type Output = Utf16Str

Source§

fn get(self, slice: &Utf16Str) -> Option<&Self::Output>

Source§

fn get_mut(self, slice: &mut Utf16Str) -> Option<&mut Self::Output>

Source§

unsafe fn get_unchecked(self, slice: &Utf16Str) -> &Self::Output

Source§

unsafe fn get_unchecked_mut(self, slice: &mut Utf16Str) -> &mut Self::Output

Source§

fn index(self, slice: &Utf16Str) -> &Self::Output

Source§

fn index_mut(self, slice: &mut Utf16Str) -> &mut Self::Output

Source§

impl SliceIndex<Utf16Str> for RangeToInclusive<usize>

Source§

type Output = Utf16Str

Source§

fn get(self, slice: &Utf16Str) -> Option<&Self::Output>

Source§

fn get_mut(self, slice: &mut Utf16Str) -> Option<&mut Self::Output>

Source§

unsafe fn get_unchecked(self, slice: &Utf16Str) -> &Self::Output

Source§

unsafe fn get_unchecked_mut(self, slice: &mut Utf16Str) -> &mut Self::Output

Source§

fn index(self, slice: &Utf16Str) -> &Self::Output

Source§

fn index_mut(self, slice: &mut Utf16Str) -> &mut Self::Output

Source§

impl StructuralPartialEq for Utf16Str

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more