[−][src]Struct swim_c::cstr::CStr
A nul-terminated sequence of C char
s.
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]
fn resident_as_ref(lease: &L) -> &CStr
[src]
impl<L: Lease<Data = u8, Meta = BufHeader<M>>, M> ResidentFromCopyUnchecked<L, CStr, M> for CString<M>
[src]
fn new_resident_layout(data: &CStr, meta: &M) -> Layout
[src]
fn new_resident_ptr(raw: *mut u8, data: &CStr, meta: &M) -> *mut u8
[src]
fn new_resident(lease: &mut L, data: &CStr, meta: M)
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<'b, S, T> StowFrom for T where
S: Stow<'b, T>,
[src]
S: Stow<'b, T>,
default fn try_stow_from(
src: S,
hold: &dyn Hold<'b>
) -> Result<T, (S, HoldError)>
[src]
src: S,
hold: &dyn Hold<'b>
) -> Result<T, (S, HoldError)>
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]
T: StowFrom<'b, S>,