Struct amethyst::ecs::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>
impl<T> TrustCell<T>pub fn new(val: T) -> TrustCell<T>
pub fn new(val: T) -> TrustCell<T>Create a new cell, similar to RefCell::new
pub fn borrow(&self) -> Ref<T>
pub fn borrow(&self) -> Ref<T>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>
pub fn try_borrow(&self) -> Result<Ref<T>, InvalidBorrow>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>
pub fn borrow_mut(&self) -> RefMut<T>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>
pub fn try_borrow_mut(&self) -> Result<RefMut<T>, InvalidBorrow>Get a mutable reference to the inner data.
Exclusive access is checked at run-time. If access is not possible, an error is returned.
ⓘImportant traits for &'a mut Rpub fn get_mut(&mut self) -> &mut T
pub fn get_mut(&mut self) -> &mut TGets 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,
impl<T> Default for TrustCell<T> where
T: Default, impl<T> Debug for TrustCell<T> where
T: Debug,
impl<T> Debug for TrustCell<T> where
T: Debug, fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>Formats the value using the given formatter. Read more
impl<T> Sync for TrustCell<T> where
T: Sync,
impl<T> Sync for TrustCell<T> where
T: Sync,