flowey_config

Macro flowey_config 

Source
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 its emit().

  • 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 Config struct with Serialize, Deserialize, Default derives
  • ConfigMerge impl with field-level equality merging
  • IntoConfig impl tying it to Node

§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()
});