[−][src]Struct shred::cell::TrustCell
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 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> Sync for TrustCell<T> where
T: Sync,
[src]
T: Sync,
impl<T> Default for TrustCell<T> where
T: Default,
[src]
T: Default,
impl<T: Debug> Debug for TrustCell<T>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: Any,
[src]
T: Any,