Skip to main content

ExecutableNode

Trait ExecutableNode 

Source
pub trait ExecutableNode: Node {
    type State;

    // Required methods
    fn init() -> Self::State;
    fn on_callback(
        state: &mut Self::State,
        callback: Callback<'_>,
        ctx: &mut CallbackCtx<'_>,
    );

    // Provided method
    fn tick(_state: &mut Self::State, _ctx: &mut TickCtx<'_>) { ... }
}

Required Associated Types§

Source

type State

Per-instance mutable state shared across the component’s callbacks.

Required Methods§

Source

fn init() -> Self::State

Build the initial state (called once by the generated runtime).

Source

fn on_callback( state: &mut Self::State, callback: Callback<'_>, ctx: &mut CallbackCtx<'_>, )

Run the body for callback. ctx exposes the triggering payload + the immediate publish path. Bodies match on the source callback name declared by create_*_for_callback_name and related helpers.

Provided Methods§

Source

fn tick(_state: &mut Self::State, _ctx: &mut TickCtx<'_>)

Per-spin execution hook (W.5.6), run between callback dispatch by the generated runtime — where the executor is free, so this is the only place a component can complete action goals / publish feedback (via ctx) or do periodic work. Default: no-op (timer/sub/service-only components).

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§