pub trait Updatable {
// Required method
fn update(&mut self, delta_time: f64);
}Expand description
A trait for objects that participate in the engine’s update step.
All implementors receive the same fixed-timestep delta time; the engine’s
scheduler is responsible for dispatching. Provides a single abstraction over
the update methods defined on Entity, Animator, SceneManager, and
the World2D / World3D physics containers, enabling generic iteration
(e.g. Vec<Box<dyn Updatable>>).
SchedulerState::tick calls into this trait through the TickHandler
trait; per-domain implementors (entities, scenes, sprites, physics worlds)
expose their own update method that satisfies this contract.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl Updatable for Animator
Forwards Animator::update through the Updatable trait so that
collections of heterogeneous updateable objects (entities, animators,
physics worlds, scene managers) can be driven by a single scheduler loop.
The inherent Animator::update method is the canonical implementation;
this impl exists purely for trait dispatch. The inherent call resolves
first when both are in scope, so there is no recursion.
impl Updatable for Entity
Forwards Entity::update through the Updatable trait so that collections
of heterogeneous updateable objects can be driven by the scheduler.
The inherent Entity::update method is the canonical implementation;
this impl exists purely for trait dispatch. The inherent call resolves
first when both are in scope, so there is no recursion.
impl Updatable for PhysicsWorld2D
Forwards PhysicsWorld2D::step through the Updatable trait so that
physics worlds participate in the same update loop as entities, animators,
and scene managers. The inherent PhysicsWorld2D::step method is the
canonical implementation; this impl exists purely for trait dispatch.
The inherent call resolves first when both are in scope, so there is no
recursion.
impl Updatable for PhysicsWorld3D
Forwards PhysicsWorld3D::step through the Updatable trait so that
3D physics worlds participate in the same update loop as their 2D
counterparts, entities, animators, and scene managers. The inherent
PhysicsWorld3D::step method is the canonical implementation; this impl
exists purely for trait dispatch. The inherent call resolves first when
both are in scope, so there is no recursion.
impl Updatable for SceneManager
Forwards SceneManager::update through the Updatable trait so that
scene managers can be driven alongside entities, animators, and physics
worlds in a single homogeneous update loop.
The inherent SceneManager::update method is the canonical implementation;
this impl exists purely for trait dispatch. The inherent call resolves
first when both are in scope, so there is no recursion.