pub struct Ptr<T> { /* private fields */ }Expand description
A pointer wrapper.
Implementations§
source§impl<T> Ptr<T>
impl<T> Ptr<T>
sourcepub unsafe fn as_ref<'pointer>(self) -> &'pointer T
pub unsafe fn as_ref<'pointer>(self) -> &'pointer T
sourcepub unsafe fn as_mut<'pointer>(self) -> &'pointer mut T
pub unsafe fn as_mut<'pointer>(self) -> &'pointer mut T
sourcepub unsafe fn drop_in_place(self)
pub unsafe fn drop_in_place(self)
Drop the value by calling the destructor, but not deallocate memory.
To deallocate memory, use Ptr::deallocate.
sourcepub unsafe fn deallocate(self)
pub unsafe fn deallocate(self)
Drop the value without calling a destructor.
sourcepub unsafe fn drop_and_deallocate(self)
pub unsafe fn drop_and_deallocate(self)
Drop the value by calling the destructor and then deallocate.
sourcepub unsafe fn read(self) -> T
pub unsafe fn read(self) -> T
Return the value. It will not lead to the pointer value being dropped.
§Panics
If the pointer is null.
sourcepub unsafe fn write(self, value: T)
pub unsafe fn write(self, value: T)
Set the value. Does not call drop the old value.
§Panics
If the pointer is null.
§Write with drop
Call Ptr::write_with_drop instead.
sourcepub unsafe fn write_with_drop(self, value: T)
pub unsafe fn write_with_drop(self, value: T)
Set the value. Drops the old value.
§Panics
If the pointer is null.
§Write no drop
Call Ptr::write instead.
Trait Implementations§
impl<T> Copy for Ptr<T>
impl<T: Send> Send for Ptr<T>
impl<T: Sync> Sync for Ptr<T>
Auto Trait Implementations§
impl<T> Freeze for Ptr<T>
impl<T> RefUnwindSafe for Ptr<T>where
T: RefUnwindSafe,
impl<T> Unpin for Ptr<T>
impl<T> UnwindSafe for Ptr<T>where
T: RefUnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)