Skip to main content

Figa

Trait Figa 

Source
pub trait Figa {
    // Required method
    fn update<'de, D>(&mut self, deserializer: D) -> Result<(), D::Error>
       where D: Deserializer<'de>;
}
Expand description

Trait for loadable layered configuration values. Uses serde for deserialization. Can be updated with other values of the same type to make a layered configuration.

Can be derived for user-defined types. Derive macro accepts attributes to control how fields are loaded.

  • #[figa(update)] causes the field to be updated with the value from the next layer. This is default behavior when no attributes are specified. Field type must implement Figa trait.
  • #[figa(replace)] causes the field to be replaced with the value from the next layer. Field must implement serde::Deserialize.
  • #[figa(append)] causes the field to be appended with the value from the next layer. Works on collections like Vec and HashSet, HashMap. Values with equal keys are replaced. Value type must implement serde::Deserialize.
  • #[figa(union)] similar to the above but works for HashSet, HashMap and similar collections. Values with equal keys are updated. Value type must implement Figa trait. Value type must implement serde::Deserialize and Figa.

This trait only defines load method to load next layer to the existing configuration value. First should be loaded by other means. Some functions load the first layer using serde::Deserialize trait.

Required Methods§

Source

fn update<'de, D>(&mut self, deserializer: D) -> Result<(), D::Error>
where D: Deserializer<'de>,

Update next layer from a deserializer.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§