[−][src]Struct legion::borrow::AtomicRefCell
A RefCell
implementation which is thread safe. This type performs all the standard runtime
borrow checking which would be familiar from using RefCell
.
UnsafeCell
is used in this type, but borrow checking is performed using atomic values,
garunteeing safe access across threads.
Safety
Runtime borrow checking is only conducted in builds with debug_assertions
enabled. Release
builds assume proper resource access and will cause undefined behavior with improper use.
Implementations
impl<T> AtomicRefCell<T>
[src]
pub fn new(value: T) -> AtomicRefCell<T>
[src]
pub fn get(&self) -> Ref<T>
[src]
Retrieve an immutable Ref
wrapped reference of &T
.
Panics
This method panics if this value is already mutably borrowed.
Safety
Runtime borrow checking is only conducted in builds with debug_assertions
enabled. Release
builds assume proper resource access and will cause undefined behavior with improper use.
pub fn into_inner(self) -> T
[src]
Unwrap the value from the RefCell and kill it, returning the value.
pub fn try_get(&self) -> Result<Ref<T>, String>
[src]
Retrieve an immutable Ref
wrapped reference of &T
. This is the safe version of get
providing an error result on failure.
Returns
Some(T)
if the value can be retrieved.
Err
if the value is already mutably borrowed.
pub fn get_mut(&self) -> RefMut<T>
[src]
Retrieve an mutable RefMut
wrapped reference of &mut T
.
Panics
This method panics if this value is already mutably borrowed.
Safety
Runtime borrow checking is only conducted in builds with debug_assertions
enabled. Release
builds assume proper resource access and will cause undefined behavior with improper use.
pub fn try_get_mut(&self) -> Result<RefMut<T>, String>
[src]
Retrieve a mutable RefMut
wrapped reference of &mut T
. This is the safe version of
get_mut
providing an error result on failure.
Returns
Some(T)
if the value can be retrieved.
Err
if the value is already mutably borrowed.
Safety
This release version of this function does not perform runtime borrow checking and will cause undefined behavior if borrow rules are violated. This means they should be enforced on the use of this type.
Trait Implementations
impl<T> Debug for AtomicRefCell<T> where
T: Debug,
[src]
T: Debug,
impl<T> Default for AtomicRefCell<T> where
T: Default,
[src]
T: Default,
fn default() -> AtomicRefCell<T>
[src]
impl<T> Send for AtomicRefCell<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for AtomicRefCell<T> where
T: Sync,
[src]
T: Sync,
Auto Trait Implementations
impl<T> !RefUnwindSafe for AtomicRefCell<T>
impl<T> Unpin for AtomicRefCell<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for AtomicRefCell<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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> Component for T where
T: 'static + Send + Sync,
[src]
T: 'static + Send + Sync,
impl<T> Downcast for T where
T: Any,
T: Any,
fn into_any(self: Box<T>) -> Box<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn as_any(&self) -> &(dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
impl<T> DowncastSync for T where
T: Send + Sync + Any,
T: Send + Sync + Any,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Resource for T where
T: 'static + Send + Sync,
[src]
T: 'static + Send + Sync,
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>,