[][src]Struct shred::cell::TrustCell

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

A custom cell container that is a RefCell with thread-safety.

Methods

impl<T> TrustCell<T>[src]

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

Create a new cell, similar to RefCell::new

pub fn into_inner(self) -> T[src]

Consumes this cell and returns ownership of T.

pub fn borrow(&self) -> Ref<T>[src]

Get an immutable reference to the inner data.

Absence of write accesses is checked at run-time.

Panics

This function will panic if there is a mutable reference to the data already in use.

pub fn try_borrow(&self) -> Result<Ref<T>, InvalidBorrow>[src]

Get an immutable reference to the inner data.

Absence of write accesses is checked at run-time. If access is not possible, an error is returned.

pub fn borrow_mut(&self) -> RefMut<T>[src]

Get a mutable reference to the inner data.

Exclusive access is checked at run-time.

Panics

This function will panic if there are any references to the data already in use.

pub fn try_borrow_mut(&self) -> Result<RefMut<T>, InvalidBorrow>[src]

Get a mutable reference to the inner data.

Exclusive access is checked at run-time. If access is not possible, an error is returned.

pub fn get_mut(&mut self) -> &mut T[src]

Gets exclusive access to the inner value, bypassing the Cell.

Exclusive access is checked at compile time.

Trait Implementations

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

impl<T> Default for TrustCell<T> where
    T: Default
[src]

impl<T> Sync for TrustCell<T> where
    T: Sync
[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for TrustCell<T>

impl<T> Send for TrustCell<T> where
    T: Send

impl<T> Unpin for TrustCell<T> where
    T: Unpin

impl<T> UnwindSafe for TrustCell<T> where
    T: UnwindSafe

Blanket Implementations

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

impl<T> Any for T where
    T: Any
[src]

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

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

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[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.