pub trait Guest {
// Required methods
fn get_manifest() -> NodeManifest;
fn get_shader_source() -> String;
fn execute_custom_action(
action_id: String,
current_params: Vec<ParamValue>,
beat_info: Option<BeatInfo>,
) -> Result<Vec<ParamUpdate>, ActionError>;
fn execute_param_compute(
current_params: Vec<ParamValue>,
source_values: Vec<ParamValue>,
beat_info: Option<BeatInfo>,
) -> Result<Vec<ControlOutput>, ActionError>;
}Required Methods§
Sourcefn get_manifest() -> NodeManifest
fn get_manifest() -> NodeManifest
§========================================================================== Exported Functions
Get node manifest
Called once during plugin load to retrieve node metadata. This is the primary definition export.
The host will:
- Validate api-version
- Calculate parameter buffer layout from parameters
- Build UI from widget configurations
- Store this definition for instantiation
Sourcefn get_shader_source() -> String
fn get_shader_source() -> String
Get WGSL shader source code
Called once during plugin load to retrieve the shader. The shader must follow binding conventions:
- @group(0): System globals (time, resolution, mouse) - Host-managed
- @group(1) @binding(0): Node parameters uniform buffer
- @group(2) @binding(N): Textures (N from texture-port.binding-slot)
The host will:
- Parse and validate WGSL with naga
- Verify bindings match manifest
- Compile to GPU pipeline
Sourcefn execute_custom_action(
action_id: String,
current_params: Vec<ParamValue>,
beat_info: Option<BeatInfo>,
) -> Result<Vec<ParamUpdate>, ActionError>
fn execute_custom_action( action_id: String, current_params: Vec<ParamValue>, beat_info: Option<BeatInfo>, ) -> Result<Vec<ParamUpdate>, ActionError>
Execute custom action (optional export)
Called when a custom action is triggered by the user. Standard actions (reset, randomize) are handled by the host.
§Parameters
- action-id: The action identifier from action-def
- current-params: Current parameter values (for context-aware actions)
- beat-info: Optional timing information for beat-sync actions
§Returns
- Ok: List of parameter updates to apply
- Err: Action execution error
§Note
If this function is not exported, all actions in the manifest must be standard actions handled by the host.
Sourcefn execute_param_compute(
current_params: Vec<ParamValue>,
source_values: Vec<ParamValue>,
beat_info: Option<BeatInfo>,
) -> Result<Vec<ControlOutput>, ActionError>
fn execute_param_compute( current_params: Vec<ParamValue>, source_values: Vec<ParamValue>, beat_info: Option<BeatInfo>, ) -> Result<Vec<ControlOutput>, ActionError>
Execute parameter computation (optional export)
Called each frame for nodes with ParamCompute actions. Reads parameters from source nodes and computes updates for target nodes.
§Parameters
- current-params: This node’s current parameter values
- source-values: Values from source nodes (as specified in param-compute-config)
- beat-info: Optional beat timing information
§Returns
- Ok: List of control outputs to send through ports
- Err: Computation error
§Note
If this function is not exported, ParamCompute actions in the manifest will be ignored.
§Migration
Previously returned list<external-param-update> with hardcoded targets.
Now returns list<control-output> where targets are determined by graph connections.
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.