Struct app_world::AppWorldWrapper
source · pub struct AppWorldWrapper<W: AppWorld> { /* private fields */ }
Expand description
Holds application state and resources. See the crate level documentation for more details.
Cloning
Cloning an AppWorldWrapper
is a very cheap operation.
All clones hold pointers to the same inner state.
Implementations§
source§impl<W: AppWorld + 'static> AppWorldWrapper<W>
impl<W: AppWorld + 'static> AppWorldWrapper<W>
source§impl<W: AppWorld + 'static> AppWorldWrapper<W>
impl<W: AppWorld + 'static> AppWorldWrapper<W>
sourcepub fn read(&self) -> WorldReadGuard<'_, W>
pub fn read(&self) -> WorldReadGuard<'_, W>
Acquire read access to AppWorld.
Panics
Panics if the current thread is already holding a read guard.
This panic prevents the following scenario from deadlocking:
- Thread A acquires a read guard
- Thread B calls
AppWorld::msg
, which attempts to acquire a write lock - Thread A attempts to acquire a second read guard while the first is still active
Trait Implementations§
Auto Trait Implementations§
impl<W> RefUnwindSafe for AppWorldWrapper<W>
impl<W> Send for AppWorldWrapper<W>where W: Send + Sync,
impl<W> Sync for AppWorldWrapper<W>where W: Send + Sync,
impl<W> Unpin for AppWorldWrapper<W>
impl<W> UnwindSafe for AppWorldWrapper<W>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more