[][src]Struct swim_c::cstr::CStr

pub struct CStr { /* fields omitted */ }

A nul-terminated sequence of C chars.

Methods

impl CStr[src]

pub fn from_ptr<'a>(ptr: *const u8) -> &'a Self[src]

Converts a pointer to a nul-terminated byte array to a CStr.

pub fn from_cptr<'a>(ptr: *const cchar) -> &'a Self[src]

Converts a pointer to a nul-terminated C char array to a CStr.

pub fn from_bytes(bytes: &[u8]) -> Result<&Self, ()>[src]

Converts a byte slice to a CStr, if the slice ends with a nul byte.

pub unsafe fn from_bytes_unchecked(bytes: &[u8]) -> &Self[src]

Converts a byte slice to a CStr, without verifying that the slice ends with a nul byte.

pub fn as_ptr(&self) -> *const u8[src]

Converts this string to a pointer to a nul-terminated byte array.

pub fn as_cptr(&self) -> *const cchar[src]

Converts this string to a pointer to a nul-terminated C char array.

pub unsafe fn to_bytes(&self) -> &[u8][src]

Returns a byte slice containing the string and trailing nul byte.

pub unsafe fn to_str(&self) -> Result<&str, Utf8Error>[src]

Returns a string slice containing the string with no trailing nul byte.

pub unsafe fn to_str_unchecked(&self) -> &str[src]

Returns a string slice containing the string with no trailing nul byte, without verifying that the string contains valid UTF-8.

Trait Implementations

impl Debug for CStr[src]

impl AsRef<CStr> for CStr[src]

impl Default for &'static CStr[src]

impl<L: Lease<Data = u8, Meta = BufHeader<M>>, M> ResidentAsRef<L, CStr> for CString<M>[src]

impl<L: Lease<Data = u8, Meta = BufHeader<M>>, M> ResidentFromCopyUnchecked<L, CStr, M> for CString<M>[src]

Auto Trait Implementations

impl Send for CStr

impl Sync for CStr

Blanket Implementations

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

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

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

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

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

impl<'b, S, T> StowFrom for T where
    S: Stow<'b, T>, 
[src]

default fn stow_from(value: T, hold: &dyn Hold<'b>) -> Self[src]

impl<'b, S, T> StowInto for S where
    T: StowFrom<'b, S>, 
[src]

default fn stow_into(self, hold: &dyn Hold<'b>) -> T[src]