Type Alias sentinel::CStr

source ·
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

source

pub const fn from_std_cstr(cstr: &CStr) -> &Self

Creates a new SSlice<T> from the provided standard core::ffi::CStr.

source

pub fn as_std_cstr(&self) -> &CStr

Turns this SSlice<T> into a standard core::ffi::CStr.

source

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_chars.

source

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.