Skip to main content

CStr

Type Alias CStr 

Source
pub type CStr<'a> = NulStr<'a, Thin>;

Aliased Type§

pub struct CStr<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> CStr<'a>

Source

pub fn to_owned_cstring(self) -> CString

Source

pub fn borrow(string: &'a CString) -> Self

Source

pub fn to_bytes(self) -> &'a [u8]

Source

pub fn to_bytes_with_nul(self) -> &'a [u8]

Source

pub fn to_str(self) -> Result<&'a str, Utf8Error>

Source

pub fn to_string_lossy(self) -> Cow<'a, str>

Source

pub const unsafe fn from_bytes_with_nul_unchecked(bytes: &'a [u8]) -> Self

Source

pub fn from_bytes_with_nul( bytes: &'a [u8], ) -> Result<Self, FromCharsWithNulError>

Source

pub fn from_bytes_until_nul( bytes: &'a [u8], ) -> Result<Self, FromCharsUntilNulError>

Trait Implementations§

Source§

impl From<&CStr> for CStr<'_>

Source§

fn from(s: &CStr) -> Self

Converts to this type from the input type.