[−][src]Struct reference_counted::Rc
A non-thread-safe reference-counted pointer.
Trait Implementations
impl<T: ?Sized> AsRef<T> for Rc<T>
[src]
impl<T: ?Sized> Borrow<T> for Rc<T>
[src]
impl<T: ?Sized> Clone for Rc<T>
[src]
fn clone(&self) -> Rc<T>
[src]
Makes a clone of the Rc
pointer.
This creates another pointer to the same allocation, increasing the reference count.
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: ?Sized + Debug> Debug for Rc<T>
[src]
impl<T: Default> Default for Rc<T>
[src]
fn default() -> Rc<T>
[src]
Creates a new Rc<T>
, with the Default
value for T
.
Examples
use std::sync::Rc; let x: Rc<i32> = Default::default(); assert_eq!(*x, 0);
impl<T: ?Sized> Deref for Rc<T>
[src]
impl<T: ?Sized + Display> Display for Rc<T>
[src]
impl<T: ?Sized> Drop for Rc<T>
[src]
fn drop(&mut self)
[src]
Drops the Rc
.
This will decrement the reference count.
Examples
use std::sync::Rc; struct Foo; impl Drop for Foo { fn drop(&mut self) { println!("dropped!"); } } let foo = Rc::new(Foo); let foo2 = Rc::clone(&foo); drop(foo); // Doesn't print anything drop(foo2); // Prints "dropped!"
impl<T: ?Sized + Eq> Eq for Rc<T>
[src]
impl<T> From<T> for Rc<T>
[src]
impl<T: ?Sized + Hash> Hash for Rc<T>
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: ?Sized> Into<Rc<T>> for UniqueRc<T>
[src]
impl<T: ?Sized> IntoMut<T> for Rc<T>
[src]
type MutablePointer = UniqueRc<T>
fn can_make_mut(this: &Self) -> bool
[src]
unsafe fn into_mut_unchecked(this: Self) -> Self::MutablePointer
[src]
unsafe fn get_mut_unchecked(this: &Self) -> &mut T
[src]
Obtain a mutable reference to the wrapped value without performing runtime checks for upholding any invariants.
Safety: Calling this is safe if and only if can_make_mut
returns true.
fn into_mut(this: Self) -> Result<Self::MutablePointer, Self>
[src]
fn get_mut(this: &Self) -> Option<&mut T>
[src]
impl<T: ?Sized + Ord> Ord for Rc<T>
[src]
fn cmp(&self, other: &Rc<T>) -> Ordering
[src]
Comparison for two Rc
s.
The two are compared by calling cmp()
on their inner values.
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<T: ?Sized + PartialEq> PartialEq<Rc<T>> for Rc<T>
[src]
fn eq(&self, other: &Rc<T>) -> bool
[src]
Equality for two Rc
s.
Two Rc
s are equal if their inner values are equal, even if they are
stored in different allocation. This implementation does not check for
pointer equality.
fn ne(&self, other: &Rc<T>) -> bool
[src]
Inequality for two Rc
s.
Two Rc
s are unequal if their inner values are unequal. This implementation does not
check for pointer equality.
impl<T: ?Sized + PartialOrd> PartialOrd<Rc<T>> for Rc<T>
[src]
fn partial_cmp(&self, other: &Rc<T>) -> Option<Ordering>
[src]
Partial comparison for two Rc
s.
The two are compared by calling partial_cmp()
on their inner values.
fn lt(&self, other: &Rc<T>) -> bool
[src]
Less-than comparison for two Rc
s.
The two are compared by calling <
on their inner values.
fn le(&self, other: &Rc<T>) -> bool
[src]
'Less than or equal to' comparison for two Rc
s.
The two are compared by calling <=
on their inner values.
fn gt(&self, other: &Rc<T>) -> bool
[src]
Greater-than comparison for two Rc
s.
The two are compared by calling >
on their inner values.
fn ge(&self, other: &Rc<T>) -> bool
[src]
'Greater than or equal to' comparison for two Rc
s.
The two are compared by calling >=
on their inner values.
impl<T: ?Sized> Pointer for Rc<T>
[src]
impl<T: ?Sized> ReferenceCounted<T> for Rc<T>
[src]
fn reference_count(this: &Self) -> usize
[src]
impl<T: ?Sized> SmartPointer<T> for Rc<T>
[src]
fn new(data: T) -> Rc<T> where
T: Sized,
[src]
T: Sized,
fn try_unwrap(this: Self) -> Result<T, Self> where
T: Sized,
[src]
T: Sized,
impl<T: ?Sized> Unpin for Rc<T>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<!> for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,