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

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

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]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

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

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

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

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [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 crate feature alloc only.

Trait Implementations

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

fn clone(&self) -> char_p_ref<'lt>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for char_p_ref<'_>[src]

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Display for char_p_ref<'_>[src]

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

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

This is supported on crate feature std only.

Panic

Panics if the CStr is not valid UTF-8.

fn from(s: &'lt CStr) -> char_p_ref<'lt>[src]

Performs the conversion.

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

fn from(it: char_p_ref<'lt>) -> char_p_raw[src]

Performs the conversion.

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

fn eq(&self, other: &Self) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

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.

fn is_valid(it: &Self::CLayout) -> bool[src]

Sanity checks that can be performed on an instance of the CType layout. Read more

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

type Error = InvalidNulTerminator<()>

The type returned in the event of a conversion error.

fn try_from(s: &'lt str) -> Result<char_p_ref<'lt>, InvalidNulTerminator<()>>[src]

Performs the conversion.

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

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

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]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> AsOut<T> for T where
    T: Copy
[src]

pub fn as_out(&'out mut self) -> Out<'out, T>[src]

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ManuallyDropMut for T[src]

type Ret = ManuallyDrop<T>

pub fn manually_drop_mut(&'__ mut self) -> &'__ mut ManuallyDrop<T>[src]

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T> ToString for T where
    T: Display + ?Sized
[src]

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.