doc.rust-lang.org
pub fn downgrade(this: &Self) -> Weak<T, A>
Creates a new Weak pointer to this allocation.
associated_function
alloc
Stable since 1.4.0
Version 1.100.0-nightly
doc.rust-lang.org
pub unsafe fn from_raw(ptr: *const T) -> Self
Constructs an Rc<T> from a raw pointer.
associated_function
alloc
Stable since 1.17.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn get_mut(this: &mut Self) -> Option<&mut T>
Returns a mutable reference into the given Rc, if there are no other Rc or Weak pointers to the same allocation.
associated_function
alloc
Stable since 1.4.0
Version 1.100.0-nightly
doc.rust-lang.org
pub unsafe fn increment_strong_count(ptr: *const T)
Increments the strong reference count on the Rc<T> associated with the provided pointer by one.
associated_function
alloc
Stable since 1.53.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_inner(this: Self) -> Option<T>
Returns the inner value, if the Rc has exactly one strong reference.
associated_function
alloc
Stable since 1.70.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_raw(this: Self) -> *const T
Consumes the Rc, returning the wrapped pointer.
associated_function
alloc
Stable since 1.17.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn make_mut(this: &mut Self) -> &mut T
Makes a mutable reference into the given Rc.
associated_function
alloc
Stable since 1.4.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn new(value: T) -> Rc<T>
Constructs a new Rc<T>.
associated_function
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn new_cyclic<F>(data_fn: F) -> Rc<T>
Constructs a new Rc<T> while giving you a Weak<T> to the allocation, to allow you to construct a T which holds a weak pointer to itself.
associated_function
alloc
Stable since 1.60.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn new_uninit() -> Rc<mem::MaybeUninit<T>>
Constructs a new Rc with uninitialized contents.
associated_function
alloc
Stable since 1.82.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn new_uninit_slice(len: usize) -> Rc<[mem::MaybeUninit<T>]>
Constructs a new reference-counted slice with uninitialized contents.
associated_function
alloc
Stable since 1.82.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn new_zeroed() -> Rc<mem::MaybeUninit<T>>
Constructs a new Rc with uninitialized contents, with the memory being filled with 0 bytes.
associated_function
alloc
Stable since 1.92.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn new_zeroed_slice(len: usize) -> Rc<[mem::MaybeUninit<T>]>
Constructs a new reference-counted slice with uninitialized contents, with the memory being filled with 0 bytes.
associated_function
alloc
Stable since 1.92.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn pin(value: T) -> Pin<Rc<T>>
Constructs a new Pin<Rc<T>>. If T does not implement Unpin, then value will be pinned in memory and unable to be moved.
associated_function
alloc
Stable since 1.33.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn ptr_eq(this: &Self, other: &Self) -> bool
Returns true if the two Rcs point to the same allocation in a vein similar to ptr::eq. This function ignores the metadata of dyn Trait pointers.
associated_function
alloc
Stable since 1.17.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn strong_count(this: &Self) -> usize
Gets the number of strong (Rc) pointers to this allocation.
associated_function
alloc
Stable since 1.15.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn try_unwrap(this: Self) -> Result<T, Self>
Returns the inner value, if the Rc has exactly one strong reference.
associated_function
alloc
Stable since 1.4.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn unwrap_or_clone(this: Self) -> T
If we have the only reference to T then unwrap it. Otherwise, clone T and return the clone.
associated_function
alloc
Stable since 1.76.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn weak_count(this: &Self) -> usize
Gets the number of Weak pointers to this allocation.
associated_function
alloc
Stable since 1.15.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct Weak<T, A>
Weak is a version of Rc that holds a non-owning reference to the managed allocation.
struct
alloc
Stable since 1.4.0
Version 1.100.0-nightly