Struct safer_ffi::char_p::char_p_boxed
source · [−]#[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
sourceimpl char_p_boxed
impl char_p_boxed
pub const unsafe fn from_ptr_unchecked(ptr: NonNull<u8>) -> char_p_boxed
Available on crate feature
alloc
only.pub fn as_ref(self: &char_p_boxed) -> char_p_ref<'_>
Available on crate feature
alloc
only.sourceimpl char_p_boxed
impl char_p_boxed
pub fn bytes<'lt>(
self: &'lt char_p_boxed
) -> impl Iterator<Item = NonZeroU8> + 'lt
Available on crate feature
alloc
only.pub fn to_nonzero_bytes(self: &char_p_boxed) -> &[NonZeroU8]
Available on crate feature
alloc
only.pub fn to_bytes(self: &char_p_boxed) -> &[u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
Available on crate feature
alloc
only.pub fn to_bytes_with_null(self: &char_p_boxed) -> &[u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
Available on crate feature
alloc
only.pub fn to_str(self: &char_p_boxed) -> &str
Available on crate feature
alloc
only.pub fn to_str_with_null(self: &char_p_boxed) -> &str
Available on crate feature
alloc
only.pub fn into_vec(self: char_p_boxed) -> Vec<u8>
Available on crate feature
alloc
only.pub fn into_string(self: char_p_boxed) -> String
Available on crate feature
alloc
only.pub fn to_owned(self: &char_p_boxed) -> char_p_boxed
Available on crate feature
alloc
only.Trait Implementations
sourceimpl Clone for char_p_boxed
Available on crate feature alloc
only.
impl Clone for char_p_boxed
Available on crate feature
alloc
only.sourceimpl Debug for char_p_boxed
Available on crate feature alloc
only.
impl Debug for char_p_boxed
Available on crate feature
alloc
only.sourceimpl Display for char_p_boxed
Available on crate feature alloc
only.
impl Display for char_p_boxed
Available on crate feature
alloc
only.sourceimpl Drop for char_p_boxed
Available on crate feature alloc
only.
impl Drop for char_p_boxed
Available on crate feature
alloc
only.sourcefn drop(self: &mut char_p_boxed)
fn drop(self: &mut char_p_boxed)
Executes the destructor for this type. Read more
sourceimpl From<CString> for char_p_boxed
Available on crate feature std
only.
impl From<CString> for char_p_boxed
Available on crate feature
std
only.Panic
Panics if the CString
is not valid UTF-8.
sourcefn from(s: CString) -> char_p_boxed
fn from(s: CString) -> char_p_boxed
Converts to this type from the input type.
sourceimpl PartialEq<char_p_boxed> for char_p_boxed
Available on crate feature alloc
only.
impl PartialEq<char_p_boxed> for char_p_boxed
Available on crate feature
alloc
only.sourceimpl ReprC for char_p_boxed where
NonNullOwned<c_char>: ReprC,
impl ReprC for char_p_boxed where
NonNullOwned<c_char>: ReprC,
sourceimpl TryFrom<String> for char_p_boxed
Available on crate feature alloc
only.
impl TryFrom<String> for char_p_boxed
Available on crate feature
alloc
only.type Error = InvalidNulTerminator<String>
type Error = InvalidNulTerminator<String>
The type returned in the event of a conversion error.
sourcefn try_from(s: String) -> Result<char_p_boxed, InvalidNulTerminator<String>>
fn try_from(s: String) -> Result<char_p_boxed, InvalidNulTerminator<String>>
Performs the conversion.
impl Eq for char_p_boxed
Available on crate feature
alloc
only.impl Send for char_p_boxed where
Box<[u8]>: Send,
Available on crate feature
alloc
only.impl Sync for char_p_boxed where
Box<[u8]>: Sync,
Available on crate feature
alloc
only.Auto Trait Implementations
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ManuallyDropMut for T
impl<T> ManuallyDropMut for T
type Ret = ManuallyDrop<T>
fn manually_drop_mut(&'__ mut self) -> &'__ mut ManuallyDrop<T>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more