[][src]Struct rcu_clean::BoxRcu

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

An owned pointer that allows interior mutability

An BoxRcu is currently the size of two pointers (plus the allocated data). So one pointer of overhead versus a plain old Box. You will probably want to to occasionally call [clean] to free up copies made when you call update. Or you could just leak memory, that's cool too.

Our benchmark oddly shows BoxRcu reads as being faster than reads using Box. I don't understand this, or particularly believe it.

let x = rcu_clean::BoxRcu::new(3);
let y: &usize = &(*x);
*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.

Methods

impl<'a, T: Clone> BoxRcu<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 BoxRcu<T>
[src]

impl<T: PartialOrd> PartialOrd<BoxRcu<T>> for BoxRcu<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: PartialEq> PartialEq<BoxRcu<T>> for BoxRcu<T>
[src]

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

This method tests for !=.

impl<T: Ord> Ord for BoxRcu<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 BoxRcu<T>
[src]

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

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

type Target = T

The resulting type after dereferencing.

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

Auto Trait Implementations

impl<T> Send for BoxRcu<T>

impl<T> Sync for BoxRcu<T>

Blanket Implementations

impl<T> From for T
[src]

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

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]