Struct chunked::world::World [−][src]
pub struct World { /* fields omitted */ }
A World manages an evolving series of Snapshot
s.
Worlds introduce the ability to do parallel work on a snapshot at the cost of requiring futures in most cases.
You can create an empty world with an empty snapshot with World::new()
.
Cloning the World
produces another view onto the same world.
Implementations
impl World
[src]
impl World
[src]pub fn with_snapshot(snapshot: Arc<Snapshot>) -> World
[src]
pub fn with_snapshot(snapshot: Arc<Snapshot>) -> World
[src]Create a new world with a given initial snapshot.
pub async fn into_snapshot(self) -> Arc<Snapshot>
[src]
pub async fn into_snapshot(self) -> Arc<Snapshot>
[src]Drop this world and return the contained snapshot.
If this is not the last view onto the same world, an error will be returned with its original value.
pub async fn replace_snapshot(&self, snapshot: Arc<Snapshot>) -> Arc<Snapshot>
[src]
pub async fn replace_snapshot(&self, snapshot: Arc<Snapshot>) -> Arc<Snapshot>
[src]Replace the snapshot of the world, returning the old snapshot.
pub async fn take_snapshot(&self) -> Arc<Snapshot>
[src]
pub async fn take_snapshot(&self) -> Arc<Snapshot>
[src]Take the current snapshot of the world and clear it.
Generally this is designed to be used as a performance optimisation: if nobody else has a reference to the Snapshot, it can be modified freely.
pub async fn set_snapshot(&self, snapshot: Arc<Snapshot>)
[src]
pub async fn set_snapshot(&self, snapshot: Arc<Snapshot>)
[src]Set the current state of the world.
pub async fn exclusive_transaction<F>(&self, f: F) where
F: FnOnce(&mut Arc<Snapshot>) + Send,
[src]
pub async fn exclusive_transaction<F>(&self, f: F) where
F: FnOnce(&mut Arc<Snapshot>) + Send,
[src]Modify the snapshot.
This takes the write lock for the snapshot for the entirety of the call
to f()
and should be used sparingly.
A good use is for applying command buffers, since it can avoid extra memory allocation.
pub async fn transaction<F>(&self, locks: impl Into<Vec<Lock>>, f: F) where
F: FnOnce(TransactionGuard<'a>) + Send + 'static,
[src]
pub async fn transaction<F>(&self, locks: impl Into<Vec<Lock>>, f: F) where
F: FnOnce(TransactionGuard<'a>) + Send + 'static,
[src]Run a non-structural transaction.
Auto Trait Implementations
impl !RefUnwindSafe for World
impl Send for World
impl Sync for World
impl Unpin for World
impl !UnwindSafe for World
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T