macro_rules! flowey_config {
(
$(#[$meta:meta])*
pub struct $Config:ident {
$(
$(#[$field_meta:meta])*
pub $field:ident : $ty:ty
),* $(,)?
}
) => { ... };
}Expand description
Declare a config struct for a flowey node.
Fields should be Option<T> or BTreeMap<K, V>:
-
Option<T>— callers set only the fields they care about. The first caller to set a field wins; subsequent callers must agree on the same value or merging will fail. The node decides which fields are required vs optional in itsemit(). -
BTreeMap<K, V>— callers contribute entries independently. Each key may only be set once; if two callers set the same key, the values must agree. Useful for per-variant or per-target configuration maps.
Generates:
- The
Configstruct withSerialize,Deserialize,Defaultderives ConfigMergeimpl with field-level equality mergingIntoConfigimpl tying it toNode
§Example
ⓘ
flowey_config! {
pub struct Config {
pub version: Option<String>,
pub auto_install: Option<bool>,
pub target_flags: BTreeMap<String, String>,
}
}Callers send config via:
ⓘ
ctx.config(node::Config {
version: Some("10.31.0".into()),
..Default::default()
});