[−][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 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> Default for TrustCell<T> where
T: Default,
[src]
T: Default,
impl<T> Sync for TrustCell<T> where
T: Sync,
[src]
T: Sync,
impl<T: Debug> Debug for TrustCell<T>
[src]
Auto Trait Implementations
impl<T> Unpin for TrustCell<T> where
T: Unpin,
T: Unpin,
impl<T> Send for TrustCell<T> where
T: Send,
T: Send,
impl<T> UnwindSafe for TrustCell<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> !RefUnwindSafe for TrustCell<T>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> 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, U> TryInto<U> 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> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Any for T where
T: Any,
[src]
T: Any,