Struct xcb::Lat1String
source · pub struct Lat1String { /* private fields */ }
Expand description
A struct owning a Latin-1 (aka. ISO 8859-1) string.
See Lat1Str for details.
Implementations§
source§impl Lat1String
impl Lat1String
sourcepub fn from_bytes(bytes: &[u8]) -> Self
pub fn from_bytes(bytes: &[u8]) -> Self
Construct a Lat1String from a slice of bytes.
sourcepub fn from_utf8(str: &str) -> Self
pub fn from_utf8(str: &str) -> Self
Construct a Lat1String from UTF-8 (a conversion to Latin-1 is performed).
Methods from Deref<Target = Lat1Str>§
sourcepub fn try_as_ascii(&self) -> Result<&str, Lat1Error>
pub fn try_as_ascii(&self) -> Result<&str, Lat1Error>
Returns the string in UTF-8 encoding, only if the string is pure ASCII.
Otherwise, a Lat1Error::NonAscii
is returned.
sourcepub fn as_ascii(&self) -> &str
pub fn as_ascii(&self) -> &str
Returns the string in UTF-8 encoding, only if the string is pure ASCII.
§Panics
This function panics if the string contains non-ASCII chars.
sourcepub unsafe fn as_ascii_unchecked(&self) -> &str
pub unsafe fn as_ascii_unchecked(&self) -> &str
Returns the string in UTF-8 encoding.
§Safety
If the string contains non-ASCII characters, the returned string will be invalid UTF-8.
Trait Implementations§
source§impl Borrow<Lat1Str> for Lat1String
impl Borrow<Lat1Str> for Lat1String
source§impl Clone for Lat1String
impl Clone for Lat1String
source§fn clone(&self) -> Lat1String
fn clone(&self) -> Lat1String
Returns a copy 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 Lat1String
impl Debug for Lat1String
source§impl Deref for Lat1String
impl Deref for Lat1String
Auto Trait Implementations§
impl Freeze for Lat1String
impl RefUnwindSafe for Lat1String
impl Send for Lat1String
impl Sync for Lat1String
impl Unpin for Lat1String
impl UnwindSafe for Lat1String
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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)