pub struct CStrHeap { /* private fields */ }Expand description
Implementations§
Source§impl CStrHeap
impl CStrHeap
Sourcepub fn new(s: CString) -> Self
pub fn new(s: CString) -> Self
Creates a new CStrHeap from a given CString.
§Arguments
s- ACStringinstance to be wrapped.
§Examples
use std::ffi::CString;
use stack_cstr::CStrHeap;
let cstr = CString::new("hello").unwrap();
let heap = CStrHeap::new(cstr);
assert_eq!(unsafe { std::ffi::CStr::from_ptr(heap.as_ptr()) }.to_str().unwrap(), "hello");Trait Implementations§
Auto Trait Implementations§
impl Freeze for CStrHeap
impl RefUnwindSafe for CStrHeap
impl Send for CStrHeap
impl Sync for CStrHeap
impl Unpin for CStrHeap
impl UnwindSafe for CStrHeap
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