Struct std::ptr::Shared [] [src]

pub struct Shared<T> where T: ?Sized {
    pointer: NonZero<*const T>,
    _marker: PhantomData<T>,
}
Unstable (shared)

: needs an RFC to flesh out design

A wrapper around a raw *mut T that indicates that the possessor of this wrapper has shared ownership of the referent. Useful for building abstractions like Rc<T> or Arc<T>, which internally use raw pointers to manage the memory that they own.

Fields

pointer
Unstable (shared)

: needs an RFC to flesh out design

_marker
Unstable (shared)

: needs an RFC to flesh out design

Methods

impl<T> Shared<T> where T: ?Sized

unsafe fn new(ptr: *mut T) -> Shared<T>

Unstable (shared)

Creates a new Shared.

Trait Implementations

impl<T> !Send for Shared<T> where T: ?Sized

Shared pointers are not Send because the data they reference may be aliased.

impl<T> !Sync for Shared<T> where T: ?Sized

Shared pointers are not Sync because the data they reference may be aliased.

impl<T> Clone for Shared<T> where T: ?Sized

fn clone(&self) -> Shared<T>

fn clone_from(&mut self, source: &Self)

impl<T> Copy for Shared<T> where T: ?Sized

impl<T, U> CoerceUnsized<Shared<U>> for Shared<T> where U: ?Sized, T: Unsize<U> + ?Sized

impl<T> Deref for Shared<T> where T: ?Sized

type Target = *mut T

fn deref(&self) -> &*mut T

impl<T> Pointer for Shared<T>

fn fmt(&self, f: &mut Formatter) -> Result<(), Error>