Struct planck_ecs::World[][src]

pub struct World { /* fields omitted */ }

Contains data indexed by type. World allows to dynamically enforce the rust rules of borrowing and ownership at runtime:

  • The same type cannot be borrowed immutably and mutably at the same time.
  • The same type cannot be borrowed mutably more than once at the same time.

Implementations

impl World[src]

pub fn initialize<T>(&mut self) where
    T: 'static + Default + Send + Sync
[src]

Initializes a resource to its default value. This is the only way to “insert” a resource.

It is suggested to use a macro to collect all the resources and initialize all of them.

pub fn get<T>(&self) -> Result<AtomicRef<'_, T>, EcsError> where
    T: 'static + Send + Sync
[src]

Get an immutable reference to a resource by type. Will return an error if the type is:

  • Non initialized
  • Already borrowed mutably

pub fn get_mut<T>(&self) -> Result<AtomicRefMut<'_, T>, EcsError> where
    T: 'static + Send + Sync
[src]

Get a mutable reference to a resource by type. Will return an error if the type is:

  • Non initialized
  • Already borrowed immutably
  • Already borrowed mutably

Trait Implementations

impl Default for World[src]

impl WorldExt for World[src]

fn maintain(&mut self)[src]

Removes dead entities from all the registered storages.

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> 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> Downcast for T where
    T: Any

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

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[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.