Skip to main content

Well

Trait Well 

Source
pub unsafe trait Well {
    type Target;

    // Required methods
    unsafe fn insert(ptr: NonNull<Self::Target>) -> Self;
    fn remove(self) -> NonNull<Self::Target>;
}
Expand description

Smart pointer.

§Safety

Types that implement this trait assert that the insert and remove methods are true inverses of each other with no side effects.

Required Associated Types§

Source

type Target

Data stored in the pointer.

Required Methods§

Source

unsafe fn insert(ptr: NonNull<Self::Target>) -> Self

Put the data back into the well.

§Safety

The pointer passed to insert must previously have been received from remove.

Source

fn remove(self) -> NonNull<Self::Target>

Take the data out of the well.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'w, T> Well for &'w T

Source§

type Target = T

Source§

unsafe fn insert(ptr: NonNull<T>) -> &'w T

Source§

fn remove(self) -> NonNull<T>

Source§

impl<T> Well for &mut T

Source§

type Target = T

Source§

unsafe fn insert(ptr: NonNull<T>) -> Self

Source§

fn remove(self) -> NonNull<T>

Source§

impl<T> Well for Box<T>

Available on crate features alloc only.
Source§

type Target = T

Source§

unsafe fn insert(ptr: NonNull<T>) -> Self

Source§

fn remove(self) -> NonNull<T>

Source§

impl<T> Well for Rc<T>

Available on crate feature alloc only.
Source§

type Target = T

Source§

unsafe fn insert(ptr: NonNull<T>) -> Self

Source§

fn remove(self) -> NonNull<T>

Source§

impl<T> Well for Weak<T>

Available on crate feature alloc only.
Source§

type Target = T

Source§

unsafe fn insert(ptr: NonNull<T>) -> Self

Source§

fn remove(self) -> NonNull<T>

Source§

impl<T> Well for Arc<T>

Available on crate features alloc only.
Source§

type Target = T

Source§

unsafe fn insert(ptr: NonNull<T>) -> Self

Source§

fn remove(self) -> NonNull<T>

Source§

impl<T> Well for Weak<T>

Available on crate features alloc only.
Source§

type Target = T

Source§

unsafe fn insert(ptr: NonNull<T>) -> Self

Source§

fn remove(self) -> NonNull<T>

Source§

impl<W: StrongWell> Well for Pin<W>

Source§

type Target = <W as Well>::Target

Source§

unsafe fn insert(ptr: NonNull<Target<W>>) -> Pin<W>

Source§

fn remove(self) -> NonNull<Target<W>>

Implementors§