[][src]Struct pebble_skip::standard_c::CStr

#[repr(transparent)]pub struct CStr<T: Storage>(_, _);

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]

Safety

As the name says, only if slice is zero-terminated and has Storage T.

#[must_use]pub unsafe fn from_zero_terminated_unchecked_mut(str: &mut str) -> &mut Self[src]

Safety

As the name says, only if slice is zero-terminated and has Storage T.

#[must_use]pub unsafe fn from_raw_parts_mut(c_str: &mut c_str, len: usize) -> &mut Self[src]

Safety

Only safe if c_str and len represent a valid zero-terminated UTF-8 string with Storage T.

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]

Safety

Safe iff str is a zero-terminated str with static storage.

Trait Implementations

impl<T: Storage> Deref for CStr<T>[src]

type Target = str

The resulting type after dereferencing.

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.

impl<'a> TryFrom<&'a str> for &'a CStr<Stack>[src]

type Error = ()

The type returned in the event of a conversion error.

impl TryFrom<&'static mut str> for &'static mut CStr<Static>[src]

type Error = ()

The type returned in the event of a conversion error.

impl TryFrom<&'static str> for &'static CStr<Static>[src]

type Error = ()

The type returned in the event of a conversion error.

Auto Trait Implementations

impl<T> Send for CStr<T> where
    T: Send

impl<T> Sync for CStr<T> where
    T: Sync

impl<T> Unpin for CStr<T> where
    T: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.