[−]Struct oxygengine_core::ecs::shred::cell::TrustCell
A custom cell container that is a RefCell
with thread-safety.
Methods
impl<T> TrustCell<T>
pub fn new(val: T) -> TrustCell<T>
Create a new cell, similar to RefCell::new
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>
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>
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>
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
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,
T: Sync,
impl<T> Debug for TrustCell<T> where
T: Debug,
T: Debug,
impl<T> Default for TrustCell<T> where
T: Default,
T: Default,
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, 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut 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> Resource for T where
T: Any + Send + Sync,
T: Any + Send + Sync,
impl<T> TryDefault for T where
T: Default,
[src]
T: Default,
fn try_default() -> Result<T, String>
[src]
fn unwrap_default() -> Self
[src]
Calls try_default
and panics on an error case.
impl<T> Any for T where
T: Any,
T: Any,
fn get_type_id(&self) -> TypeId
impl<T> Event for T where
T: Send + Sync + 'static,
T: Send + Sync + 'static,