[][src]Struct rcu_clean::ArcRcu

pub struct ArcRcu<T> { /* fields omitted */ }

A thread-safe reference counted pointer that allows interior mutability

The ArcRcu is functionally roughly equivalent to Arc<RwLock<T>>, except that reads (of the old value) may happen while a write is taking place. Reads on an ArcRcu are much faster (by a factor of 2 or 3) than reads on either a Arc<RwLock<T>> or a Arc<Mutex<T>>. So in this case you gain both ergonomics and read speed. Writes are slow, so only use this type if writes are rare (or their speed doesn't matter).

let x = rcu_clean::ArcRcu::new(3);
let y: &usize = &(*x);
let z = x.clone();
*x.update() = 7; // Wow, we are mutating something we have borrowed!
assert_eq!(*y, 3); // the old reference is still valid.
assert_eq!(*x, 7); // but the pointer now points to the new value.
assert_eq!(*z, 7); // but the cloned pointer also points to the new value.

Methods

impl<'a, T: Clone> ArcRcu<T>
[src]

pub fn new(x: T) -> Self
[src]

pub fn update(&'a self) -> Guard<'a, T>
[src]

pub fn clean(&mut self)
[src]

Trait Implementations

impl<T: Eq> Eq for ArcRcu<T>
[src]

impl<T: Send + Sync> Send for ArcRcu<T>
[src]

impl<T: PartialOrd> PartialOrd<ArcRcu<T>> for ArcRcu<T>
[src]

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<T: Send + Sync> Sync for ArcRcu<T>
[src]

impl<T: PartialEq> PartialEq<ArcRcu<T>> for ArcRcu<T>
[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl<T: Clone> Clone for ArcRcu<T>
[src]

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

Performs copy-assignment from source. Read more

impl<T: Ord> Ord for ArcRcu<T>
[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl<T: Debug> Debug for ArcRcu<T>
[src]

impl<T: Display> Display for ArcRcu<T>
[src]

impl<T> Deref for ArcRcu<T>
[src]

type Target = T

The resulting type after dereferencing.

impl<T> Borrow<T> for ArcRcu<T>
[src]

Blanket Implementations

impl<T> From for T
[src]

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

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

type Owned = T

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

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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