Struct safer_ffi::char_p::char_p_boxed [−][src]
#[repr(transparent)]pub struct char_p_boxed(_);
Expand description
A #[repr(c)]
null-terminated UTF-8 encoded string, for compatibility
with both the char *
C API and Rust str
.
This is an owned / heap-allocated version, much like Box<str>
/ Box<CStr>
but for it being a slim pointer.
C Layout
Implementations
impl char_p_boxed
[src]
impl char_p_boxed
[src]pub const unsafe fn from_ptr_unchecked(ptr: NonNull<u8>) -> char_p_boxed
[src]
This is supported on crate feature
alloc
only.pub fn as_ref(self: &char_p_boxed) -> char_p_ref<'_>
[src]
This is supported on crate feature
alloc
only.impl char_p_boxed
[src]
impl char_p_boxed
[src]pub fn bytes<'lt>(
self: &'lt char_p_boxed
) -> impl Iterator<Item = NonZeroU8> + 'lt
[src]
self: &'lt char_p_boxed
) -> impl Iterator<Item = NonZeroU8> + 'lt
This is supported on crate feature
alloc
only.pub fn to_nonzero_bytes(self: &char_p_boxed) -> &[NonZeroU8]ⓘ
[src]
This is supported on crate feature
alloc
only.pub fn to_bytes(self: &char_p_boxed) -> &[u8]ⓘ
[src]
This is supported on crate feature
alloc
only.pub fn to_bytes_with_null(self: &char_p_boxed) -> &[u8]ⓘ
[src]
This is supported on crate feature
alloc
only.pub fn to_str(self: &char_p_boxed) -> &str
[src]
This is supported on crate feature
alloc
only.pub fn to_str_with_null(self: &char_p_boxed) -> &str
[src]
This is supported on crate feature
alloc
only.pub fn into_vec(self: char_p_boxed) -> Vec<u8>
[src]
This is supported on crate feature
alloc
only.pub fn into_string(self: char_p_boxed) -> String
[src]
This is supported on crate feature
alloc
only.pub fn to_owned(self: &char_p_boxed) -> char_p_boxed
[src]
This is supported on crate feature
alloc
only.Trait Implementations
impl Clone for char_p_boxed
[src]
impl Clone for char_p_boxed
[src]This is supported on crate feature
alloc
only.impl Debug for char_p_boxed
[src]
impl Debug for char_p_boxed
[src]This is supported on crate feature
alloc
only.impl Display for char_p_boxed
[src]
impl Display for char_p_boxed
[src]This is supported on crate feature
alloc
only.impl Drop for char_p_boxed
[src]
impl Drop for char_p_boxed
[src]This is supported on crate feature
alloc
only.fn drop(self: &mut char_p_boxed)
[src]
fn drop(self: &mut char_p_boxed)
[src]Executes the destructor for this type. Read more
impl From<CString> for char_p_boxed
[src]
impl From<CString> for char_p_boxed
[src]This is supported on crate feature
std
only.Panic
Panics if the CString
is not valid UTF-8.
fn from(s: CString) -> char_p_boxed
[src]
fn from(s: CString) -> char_p_boxed
[src]Performs the conversion.
impl PartialEq<char_p_boxed> for char_p_boxed
[src]
impl PartialEq<char_p_boxed> for char_p_boxed
[src]This is supported on crate feature
alloc
only.impl ReprC for char_p_boxed where
NonNullOwned<c_char>: ReprC,
[src]
impl ReprC for char_p_boxed where
NonNullOwned<c_char>: ReprC,
[src]impl TryFrom<String> for char_p_boxed
[src]
impl TryFrom<String> for char_p_boxed
[src]This is supported on crate feature
alloc
only.type Error = InvalidNulTerminator<String>
type Error = InvalidNulTerminator<String>
The type returned in the event of a conversion error.
fn try_from(s: String) -> Result<char_p_boxed, InvalidNulTerminator<String>>
[src]
fn try_from(s: String) -> Result<char_p_boxed, InvalidNulTerminator<String>>
[src]Performs the conversion.
impl Eq for char_p_boxed
[src]
This is supported on crate feature
alloc
only.impl Send for char_p_boxed where
Box<[u8]>: Send,
[src]
Box<[u8]>: Send,
This is supported on crate feature
alloc
only.impl Sync for char_p_boxed where
Box<[u8]>: Sync,
[src]
Box<[u8]>: Sync,
This is supported on crate feature
alloc
only.Auto Trait Implementations
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ManuallyDropMut for T
[src]
impl<T> ManuallyDropMut for T
[src]impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
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]
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