[−][src]Struct pebble_skip::standard_c::CStr
A zero-terminated UTF-8 string slice.
Note: When dereferencing this type to str
, the trailing '\0'
is not included.
Why this is reimplemented (aside from not being in core
):
Comment on std::ffi::CStr
:
// Anyway, `CStr` representation and layout are considered implementation detail, are
// not documented and must not be relied upon.
Implementations
impl<T: Storage> CStr<T>
[src]
#[must_use]pub fn as_c_str(&self) -> &c_str
[src]
#[must_use]pub fn as_c_str_mut(&mut self) -> &mut c_str
[src]
impl<T: Storage> CStr<T>
[src]
#[must_use]pub unsafe fn from_zero_terminated_unchecked(str: &str) -> &Self
[src]
#[must_use]pub unsafe fn from_zero_terminated_unchecked_mut(str: &mut str) -> &mut Self
[src]
#[must_use]pub unsafe fn from_raw_parts_mut(c_str: &mut c_str, len: usize) -> &mut Self
[src]
impl CStr<Stack>
[src]
pub fn try_from_stack(str: &str) -> Result<&Self, ()>
[src]
Errors
If str
doesn't end with '\0'
.
impl CStr<Static>
[src]
pub fn try_from_static(str: &'static str) -> Result<&'static Self, ()>
[src]
Errors
If str
doesn't end with '\0'
.
#[must_use]pub unsafe fn from_static_zero_terminated_unchecked(
str: &'static str
) -> &'static Self
[src]
str: &'static str
) -> &'static Self
Safety
Safe iff str is a zero-terminated str with static storage.
Trait Implementations
impl<T: Storage> Deref for CStr<T>
[src]
impl<T: Storage> DerefMut for CStr<T>
[src]
impl<'a> TryFrom<&'a mut str> for &'a mut CStr<Stack>
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: &'a mut str) -> Result<Self, Self::Error>
[src]
impl<'a> TryFrom<&'a str> for &'a CStr<Stack>
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: &'a str) -> Result<Self, Self::Error>
[src]
impl TryFrom<&'static mut str> for &'static mut CStr<Static>
[src]
type Error = ()
The type returned in the event of a conversion error.
fn try_from(value: &'static mut str) -> Result<Self, Self::Error>
[src]
impl TryFrom<&'static str> for &'static CStr<Static>
[src]
Auto Trait Implementations
impl<T> Send for CStr<T> where
T: Send,
T: Send,
impl<T> Sync for CStr<T> where
T: Sync,
T: Sync,
impl<T> Unpin for CStr<T> where
T: Unpin,
T: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,