pub unsafe trait SharedPointerKind: Sized + Debug {
    // Required methods
    fn new<T>(v: T) -> Self;
    fn from_box<T>(v: Box<T>) -> Self;
    unsafe fn as_ptr<T>(&self) -> *const T;
    unsafe fn deref<T>(&self) -> &T;
    unsafe fn try_unwrap<T>(self) -> Result<T, Self>;
    unsafe fn get_mut<T>(&mut self) -> Option<&mut T>;
    unsafe fn make_mut<T: Clone>(&mut self) -> &mut T;
    unsafe fn strong_count<T>(&self) -> usize;
    unsafe fn clone<T>(&self) -> Self;
    unsafe fn drop<T>(&mut self);
}
Expand description

Trait for type constructors of reference-counting pointers.

§Safety

T may be !Unpin, and SharedPointer may be held in a pinned form (Pin<SharedPointer<T, Self>>). As such, the implementation of this trait must uphold the pinning invariants for T while it’s held in Self. Specifically, this necessitates the following:

  • &mut T is only exposed through the trait methods returning &mut T.

  • The implementor must not move out the contained T unless the semantics of trait methods demands that.

  • Self::drop drops T in place.

Required Methods§

source

fn new<T>(v: T) -> Self

source

fn from_box<T>(v: Box<T>) -> Self

source

unsafe fn as_ptr<T>(&self) -> *const T

source

unsafe fn deref<T>(&self) -> &T

source

unsafe fn try_unwrap<T>(self) -> Result<T, Self>

source

unsafe fn get_mut<T>(&mut self) -> Option<&mut T>

source

unsafe fn make_mut<T: Clone>(&mut self) -> &mut T

source

unsafe fn strong_count<T>(&self) -> usize

source

unsafe fn clone<T>(&self) -> Self

source

unsafe fn drop<T>(&mut self)

Object Safety§

This trait is not object safe.

Implementors§