pub struct LxString { /* private fields */ }Expand description
An owned string that may or may not be valid utf-8.
This is analogous to OsString on Linux, but behaves the same on all platforms.
Implementations§
Source§impl LxString
impl LxString
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a LxString with the specified capacity.
Sourcepub fn into_string(self) -> Result<String, Self>
pub fn into_string(self) -> Result<String, Self>
Converts the LxString into a String if it contains valid Unicode data.
Sourcepub fn push(&mut self, s: impl AsRef<LxStr>)
pub fn push(&mut self, s: impl AsRef<LxStr>)
Extends the string with the given AsRef<LxStr> slice.
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional more capacity to be inserted into this string.
Sourcepub fn reserve_exact(&mut self, additional: usize)
pub fn reserve_exact(&mut self, additional: usize)
Reserves the minimum capacity for exactly additional more capacity to be inserted into this string. Does nothing if the capacity is already sufficient.
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of this string to match its length.
Methods from Deref<Target = LxStr>§
Sourcepub fn to_lx_string(&self) -> LxString
pub fn to_lx_string(&self) -> LxString
Copies the slice into an owned LxString.
Sourcepub fn to_string_lossy(&self) -> Cow<'_, str>
pub fn to_string_lossy(&self) -> Cow<'_, str>
Convert an LxStr to a Cow<str>.
Any non-Unicode sequences are replaced with U+FFFD REPLACEMENT CHARACTER.
Trait Implementations§
impl Eq for LxString
impl StructuralPartialEq for LxString
Auto Trait Implementations§
impl Freeze for LxString
impl RefUnwindSafe for LxString
impl Send for LxString
impl Sync for LxString
impl Unpin for LxString
impl UnwindSafe for LxString
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