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§
Sourcefn on_created(&mut self)
fn on_created(&mut self)
Called when the module is first mounted.
Sourcefn on_destroyed(&mut self)
fn on_destroyed(&mut self)
Called when the module is unmounted and about to be dropped.
Sourcefn on_state_changed(&mut self, state: Value)
fn on_state_changed(&mut self, state: Value)
Called when state is updated from the host.