[][src]Struct reference_counted::Rc

pub struct Rc<T: ?Sized> { /* fields omitted */ }

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.

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]

type Target = T

The resulting type after dereferencing.

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]

impl<T: ?Sized> Into<Rc<T>> for UniqueRc<T>[src]

impl<T: ?Sized> IntoMut<T> for Rc<T>[src]

type MutablePointer = UniqueRc<T>

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.

impl<T: ?Sized + Ord> Ord for Rc<T>[src]

fn cmp(&self, other: &Rc<T>) -> Ordering[src]

Comparison for two Rcs.

The two are compared by calling cmp() on their inner values.

impl<T: ?Sized + PartialEq> PartialEq<Rc<T>> for Rc<T>[src]

fn eq(&self, other: &Rc<T>) -> bool[src]

Equality for two Rcs.

Two Rcs 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 Rcs.

Two Rcs 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 Rcs.

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 Rcs.

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 Rcs.

The two are compared by calling <= on their inner values.

fn gt(&self, other: &Rc<T>) -> bool[src]

Greater-than comparison for two Rcs.

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 Rcs.

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]

impl<T: ?Sized> SmartPointer<T> for Rc<T>[src]

impl<T: ?Sized> Unpin for Rc<T>[src]

Auto Trait Implementations

impl<T> !Send for Rc<T>

impl<T> !Sync for Rc<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[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]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.