[][src]Struct safer_ffi::char_p::char_p_ref

#[repr(transparent)]pub struct char_p_ref<'lt>(_, _);

A #[repr(c)] null-terminated UTF-8 encoded string, for compatibility with both the C char * API and Rust's str.

This is a borrowed version, i.e., with the semantics of &'lt CStr / &'lt str, but for it being a slim pointer.

C Layout

Implementations

impl char_p_ref<'static>[src]

pub const EMPTY: Self[src]

impl<'lt> char_p_ref<'lt>[src]

pub const unsafe fn from_ptr_unchecked(ptr: NonNull<u8>) -> Self[src]

impl<'lt> char_p_ref<'lt>[src]

pub fn bytes(self: char_p_ref<'lt>) -> impl Iterator<Item = NonZeroU8> + 'lt[src]

pub fn to_nonzero_bytes(self: char_p_ref<'lt>) -> &'lt [NonZeroU8][src]

pub fn to_bytes(self: char_p_ref<'lt>) -> &'lt [u8][src]

pub fn to_bytes_with_null(self: char_p_ref<'lt>) -> &'lt [u8][src]

pub fn to_str(self: char_p_ref<'lt>) -> &'lt str[src]

pub fn to_str_with_null(self: char_p_ref<'lt>) -> &'lt str[src]

pub fn to_owned(self: char_p_ref<'lt>) -> char_p_boxed[src]

This is supported on feature="alloc" only.

Trait Implementations

impl<'lt> Clone for char_p_ref<'lt>[src]

impl<'lt> Copy for char_p_ref<'lt>[src]

impl<'_> Debug for char_p_ref<'_>[src]

impl<'_> Display for char_p_ref<'_>[src]

impl<'lt> Eq for char_p_ref<'lt>[src]

impl<'lt> From<&'lt CStr> for char_p_ref<'lt>[src]

Panic

Panics if the CStr is not valid UTF-8.

impl<'lt> From<char_p_ref<'lt>> for char_p_raw[src]

impl<'lt> PartialEq<char_p_ref<'lt>> for char_p_ref<'lt>[src]

impl<'lt> ReprC for char_p_ref<'lt> where
    NonNullRef<c_char>: ReprC
[src]

type CLayout = <NonNullRef<c_char> as ReprC>::CLayout

The CType having the same layout as Self.

impl<'lt> TryFrom<&'lt str> for char_p_ref<'lt>[src]

type Error = InvalidNulTerminator<()>

The type returned in the event of a conversion error.

Auto Trait Implementations

impl<'lt> RefUnwindSafe for char_p_ref<'lt>

impl<'lt> !Send for char_p_ref<'lt>

impl<'lt> !Sync for char_p_ref<'lt>

impl<'lt> Unpin for char_p_ref<'lt>

impl<'lt> UnwindSafe for char_p_ref<'lt>

Blanket Implementations

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

impl<T> AsOut<T> for T where
    T: Copy

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> ManuallyDropMut for T

type Ret = ManuallyDrop<T>

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[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.