pub struct Mutf8String { /* private fields */ }
Expand description
An owned MUTF-8 string.
Implementations§
Source§impl Mutf8String
impl Mutf8String
pub fn new() -> Self
pub fn as_str(&self) -> &Mutf8Str
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Convert this MUTF-8 string into a UTF-8 string. If the data isn’t valid MUTF-8, it’ll return an empty string without erroring.
Sourcepub fn try_into_string(self) -> Result<String, DecodingError>
pub fn try_into_string(self) -> Result<String, DecodingError>
Try to convert this MUTF-8 string into a UTF-8 string.
pub fn from_string(s: String) -> Mutf8String
pub fn from_vec(vec: Vec<u8>) -> Mutf8String
Methods from Deref<Target = Mutf8Str>§
Sourcepub fn to_str(&self) -> Cow<'_, str>
pub fn to_str(&self) -> Cow<'_, str>
Try to convert this MUTF-8 string into a UTF-8 string. If the data isn’t valid MUTF-8, it’ll return an empty string without erroring.
pub fn to_string_lossy(&self) -> Cow<'_, str>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn as_bytes(&self) -> &[u8] ⓘ
Trait Implementations§
Source§impl Borrow<Mutf8Str> for Mutf8String
impl Borrow<Mutf8Str> for Mutf8String
Source§impl Clone for Mutf8String
impl Clone for Mutf8String
Source§fn clone(&self) -> Mutf8String
fn clone(&self) -> Mutf8String
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Mutf8String
impl Debug for Mutf8String
Source§impl Default for Mutf8String
impl Default for Mutf8String
Source§fn default() -> Mutf8String
fn default() -> Mutf8String
Returns the “default value” for a type. Read more
Source§impl Deref for Mutf8String
impl Deref for Mutf8String
Source§impl From<&Mutf8Str> for Mutf8String
impl From<&Mutf8Str> for Mutf8String
Source§impl From<&str> for Mutf8String
impl From<&str> for Mutf8String
Source§impl From<String> for Mutf8String
impl From<String> for Mutf8String
Source§impl PartialEq for Mutf8String
impl PartialEq for Mutf8String
Source§impl Serialize for Mutf8String
impl Serialize for Mutf8String
impl Eq for Mutf8String
impl StructuralPartialEq for Mutf8String
Auto Trait Implementations§
impl Freeze for Mutf8String
impl RefUnwindSafe for Mutf8String
impl Send for Mutf8String
impl Sync for Mutf8String
impl Unpin for Mutf8String
impl UnwindSafe for Mutf8String
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