pub struct LxStr { /* private fields */ }
Expand description
A borrowed reference to a string that may or may not be valid utf-8.
This is analogous to OsStr
on Linux, but behaves the same on all platforms.
Implementations§
Source§impl LxStr
impl LxStr
Sourcepub fn from_bytes(slice: &[u8]) -> &LxStr
pub fn from_bytes(slice: &[u8]) -> &LxStr
Creates an LxStr
from a byte slice.
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
.