Struct core::ptr::Shared [] [src]

pub struct Shared<T: ?Sized> {
    // some fields omitted
}
Unstable (shared #27730)

: needs an RFC to flesh out design

A wrapper around a raw non-null *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.

Methods

impl<T: ?Sized> Shared<T>

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

Unstable (shared #27730)

Creates a new Shared.

Safety

ptr must be non-null.

Trait Implementations

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

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

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

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

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

fn clone(&self) -> Self

Unstable (shared #27730)

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

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

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

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

type Target = *mut T

Unstable (shared #27730)

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

Unstable (shared #27730)

impl<T> Pointer for Shared<T>

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

Unstable (shared #27730)