ConfigField

Trait ConfigField 

pub trait ConfigField {
    // Required method
    fn merge_field(
        &mut self,
        field_name: &str,
        other: Self,
    ) -> Result<(), Error>;
}
Expand description

Trait for merging a single config field. The flowey_config! macro calls ConfigField::merge_field on each field during config merging.

Implemented for:

  • Option<T>: first setter wins, subsequent must agree (PartialEq)
  • BTreeMap<K, V>: per-key merge, each key’s value must agree

Required Methods§

fn merge_field(&mut self, field_name: &str, other: Self) -> Result<(), Error>

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.

Implementations on Foreign Types§

§

impl<K, V> ConfigField for BTreeMap<K, V>
where K: Ord + Debug, V: PartialEq,

§

fn merge_field( &mut self, field_name: &str, other: BTreeMap<K, V>, ) -> Result<(), Error>

§

impl<T> ConfigField for Option<T>
where T: PartialEq,

§

fn merge_field( &mut self, field_name: &str, other: Option<T>, ) -> Result<(), Error>

Implementors§