Trait Resource

Source
pub trait Resource: 'static + Sized {
    // Provided methods
    fn update(&mut self) { ... }
    fn as_any(&self) -> &dyn Any { ... }
    fn as_any_mut(&mut self) -> &mut dyn Any { ... }
}
Expand description

Resources are objects that are not components and do not have any relation to entities They are a sort of blend between an entity and a system, they have their own update method that is called every frame like a system But unlike a system, they can be accessed by systems

Provided Methods§

Source

fn update(&mut self)

This method is called every frame

Source

fn as_any(&self) -> &dyn Any

This method is needed to allow the resource to be downcast

Source

fn as_any_mut(&mut self) -> &mut dyn Any

This method is needed to allow the resource to be downcast mutably

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§