Trait FlowNodeWithConfig
pub trait FlowNodeWithConfig {
type Request: Serialize + DeserializeOwned;
type Config: ConfigMerge;
// Required methods
fn imports(ctx: &mut ImportCtx<'_>);
fn emit(
config: Self::Config,
requests: Vec<Self::Request>,
ctx: &mut NodeCtx<'_>,
) -> Result<(), Error>;
}Expand description
A FlowNode variant that receives a typed, pre-merged config alongside
its requests.
Use this when a node has “config” values (e.g., version strings, feature flags) that must agree across all callers AND are needed to emit outgoing requests or steps.
The framework merges config from all callers (validating equality) and
delivers the finalized Config to emit(). The node never sees raw
config requests — they are handled by the infrastructure.
§Example
flowey_config! {
pub struct Config {
pub version: Option<String>,
}
}
flowey_request! {
pub enum Request {
GetAzCopy(WriteVar<PathBuf>),
}
}
new_flow_node_with_config!(struct Node);
impl FlowNodeWithConfig for Node {
type Request = Request;
type Config = Config;
fn imports(ctx: &mut ImportCtx<'_>) { /* ... */ }
fn emit(
config: Config,
requests: Vec<Self::Request>,
ctx: &mut NodeCtx<'_>,
) -> anyhow::Result<()> {
let version = config.version
.ok_or(anyhow::anyhow!("missing config: version"))?;
// ...
Ok(())
}
}Required Associated Types§
type Request: Serialize + DeserializeOwned
type Request: Serialize + DeserializeOwned
The request type (action requests only — no config variants).
type Config: ConfigMerge
type Config: ConfigMerge
The config type generated by flowey_config!.
Scalar fields are typically wrapped in Option<T>, and the node decides which
options are treated as required vs optional. Configs may also include
non-Option mergeable fields (for example, maps) that are combined according
to the ConfigMerge implementation.
Required Methods§
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.