Struct safer_ffi::char_p::char_p_boxed
source · pub struct char_p_boxed(/* private fields */);
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§
source§impl 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.source§impl 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] ⓘ
Available on crate feature
alloc
only.pub fn to_bytes_with_null(self: &char_p_boxed) -> &[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§
source§impl Clone for char_p_boxed
Available on crate feature alloc
only.
impl Clone for char_p_boxed
Available on crate feature
alloc
only.source§impl Debug for char_p_boxed
Available on crate feature alloc
only.
impl Debug for char_p_boxed
Available on crate feature
alloc
only.source§impl Display for char_p_boxed
Available on crate feature alloc
only.
impl Display for char_p_boxed
Available on crate feature
alloc
only.source§impl Drop for char_p_boxed
Available on crate feature alloc
only.
impl Drop for char_p_boxed
Available on crate feature
alloc
only.source§fn drop(self: &mut char_p_boxed)
fn drop(self: &mut char_p_boxed)
Executes the destructor for this type. Read more
source§impl 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.
source§fn from(s: CString) -> char_p_boxed
fn from(s: CString) -> char_p_boxed
Converts to this type from the input type.
source§impl PartialEq for char_p_boxed
Available on crate feature alloc
only.
impl PartialEq for char_p_boxed
Available on crate feature
alloc
only.source§impl ReprC for char_p_boxed
impl ReprC for char_p_boxed
source§impl 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.
source§fn 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
Available on crate feature
alloc
only.impl Sync for char_p_boxed
Available on crate feature
alloc
only.Auto Trait Implementations§
impl Freeze for char_p_boxed
impl RefUnwindSafe for char_p_boxed
impl Unpin for char_p_boxed
impl UnwindSafe for char_p_boxed
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> ConcreteReprC for T
impl<T> ConcreteReprC for T
type ConcreteCLayout = <T as ReprC>::CLayout
source§impl<T> FitForCBox for T
impl<T> FitForCBox for T
§type CBoxWrapped = Box_<T>
type CBoxWrapped = Box_<T>
Available on crate feature
alloc
only.