Skip to main content

ModuleLifecycle

Trait ModuleLifecycle 

Source
pub trait ModuleLifecycle {
    // Required methods
    fn on_created(&mut self);
    fn on_destroyed(&mut self);
    fn on_state_changed(&mut self, state: Value);
}
Expand description

Lifecycle hooks for a module.

Implement this trait to receive notifications when a module is created, destroyed, or when its state changes. This is primarily used by SDK implementations to bridge engine lifecycle events to host language callbacks.

Required Methods§

Source

fn on_created(&mut self)

Called when the module is first mounted.

Source

fn on_destroyed(&mut self)

Called when the module is unmounted and about to be dropped.

Source

fn on_state_changed(&mut self, state: Value)

Called when state is updated from the host.

Implementors§