pub struct String16 { /* private fields */ }Expand description
A UTF-16 encoded, growable string.
§Examples
let mut string16 = String16::from(“Übung”); string16.push(‘ä’);
Implementations§
Source§impl String16
impl String16
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the length of this String16, in bytes.
§Examples
Basic usage:
let a = String16::from(“Übung”);
assert_eq!(a.len(), 5);
Sourcepub fn as_bytes(&self) -> &[u16]
pub fn as_bytes(&self) -> &[u16]
Returns a slice of u16s bytes that were attempted to convert to a String.
Sourcepub fn as_bytes_mut(&mut self) -> &mut [u16]
pub fn as_bytes_mut(&mut self) -> &mut [u16]
Returns a mutable slice of u16s bytes that were attempted to convert to a String.
Sourcepub fn insert_str(&mut self, idx: usize, string: &str)
pub fn insert_str(&mut self, idx: usize, string: &str)
Inserts a string slice into this String16 at a byte position.
Sourcepub fn remove(&mut self, idx: usize)
pub fn remove(&mut self, idx: usize)
Removes a char from this String16 at a byte position and returns it.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if this String16 has a length of zero, and false otherwise.
Sourcepub fn ends_with(&self, pat: &str) -> bool
pub fn ends_with(&self, pat: &str) -> bool
Returns true if this String16 ends with the given string slice, or false otherwise.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for String16
impl<'de> Deserialize<'de> for String16
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<String16, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<String16, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for String16
impl Serialize for String16
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for String16
Auto Trait Implementations§
impl Freeze for String16
impl RefUnwindSafe for String16
impl Send for String16
impl Sync for String16
impl Unpin for String16
impl UnsafeUnpin for String16
impl UnwindSafe for String16
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more