[][src]Struct legion::borrow::AtomicRefCell

pub struct AtomicRefCell<T> { /* fields omitted */ }

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]

impl<T> Default for AtomicRefCell<T> where
    T: Default
[src]

impl<T> Send for AtomicRefCell<T> where
    T: Send
[src]

impl<T> Sync for AtomicRefCell<T> where
    T: Sync
[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for AtomicRefCell<T>

impl<T> Unpin for AtomicRefCell<T> where
    T: Unpin

impl<T> UnwindSafe for AtomicRefCell<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Component for T where
    T: 'static + Send + Sync
[src]

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Send + Sync + Any

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Resource for T where
    T: 'static + Send + Sync
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.