[][src]Trait abi_stable::pointer_trait::OwnedPointer

pub unsafe trait OwnedPointer: Sized + DerefMut + GetPointerKind {
    unsafe fn get_move_ptr(
        this: &mut ManuallyDrop<Self>
    ) -> MovePtr<Self::Target>
    where
        Self::Target: Sized
;
unsafe fn drop_allocation(this: &mut ManuallyDrop<Self>); fn with_move_ptr<F, R>(this: ManuallyDrop<Self>, f: F) -> R
    where
        F: FnOnce(MovePtr<Self::Target>) -> R,
        Self::Target: Sized
, { ... }
fn in_move_ptr<F, R>(self, f: F) -> R
    where
        F: FnOnce(MovePtr<Self::Target>) -> R,
        Self::Target: Sized
, { ... } }

For owned pointers,allows extracting their contents separate from deallocating them.

Safety for implementor

  • The pointer type is either !Drop(no drop glue either), or it uses a vtable to Drop the referent and deallocate the memory correctly.

Required methods

unsafe fn get_move_ptr(this: &mut ManuallyDrop<Self>) -> MovePtr<Self::Target> where
    Self::Target: Sized

Gets a move pointer to the contents of this pointer.

Safety

This function logically moves the owned contents out of this pointer, the only safe thing that can be done with the pointer afterwads is to call OwnedPointer::drop_allocation.

unsafe fn drop_allocation(this: &mut ManuallyDrop<Self>)

Deallocates the pointer without dropping its owned contents.

Note that if Self::get_move_ptr has not been called this will leak the values owned by the referent of the pointer.

Loading content...

Provided methods

fn with_move_ptr<F, R>(this: ManuallyDrop<Self>, f: F) -> R where
    F: FnOnce(MovePtr<Self::Target>) -> R,
    Self::Target: Sized

fn in_move_ptr<F, R>(self, f: F) -> R where
    F: FnOnce(MovePtr<Self::Target>) -> R,
    Self::Target: Sized

Loading content...

Implementors

impl<T> OwnedPointer for RBox<T>[src]

impl<T, Inline> OwnedPointer for RSmallBox<T, Inline>[src]

Loading content...