pub type CStr = SSlice<u8>;
Expand description
A type that wraps a “C-like” string.
When you hold a reference to a CStr
, you are guarenteed that it is null-terminated. This type
knows this and allows safe manipulation of those bytes.
Aliased Type§
struct CStr { /* private fields */ }
Implementations§
source§impl CStr
impl CStr
sourcepub const fn from_std_cstr(cstr: &CStr) -> &Self
pub const fn from_std_cstr(cstr: &CStr) -> &Self
Creates a new SSlice<T>
from the provided standard core::ffi::CStr
.
sourcepub fn as_std_cstr(&self) -> &CStr
pub fn as_std_cstr(&self) -> &CStr
Turns this SSlice<T>
into a standard core::ffi::CStr
.
sourcepub const fn cast_to_slice_of_cstrs<'a>(
slice: &'a [&Self]
) -> &'a [*const c_char]
pub const fn cast_to_slice_of_cstrs<'a>( slice: &'a [&Self] ) -> &'a [*const c_char]
Casts a slice of CStr
values into a slice of *const c_char
s.
sourcepub const fn display(&self) -> &Display
pub const fn display(&self) -> &Display
An implementation of fmt::Display
and fmt::Debug
for the CStr
type.
When an invalid character is found, the REPLACEMENT_CHARACTER
is displayed instead.