Trait configuration::Configuration[][src]

pub trait Configuration<'a> {
    type Encoder: Serialize;
    fn diff(&self, _: &Self) -> ConfigChange;
fn update(&mut self, _: ConfigChange);
fn get_encoder(&'a self) -> Self::Encoder;
fn typed(&self) -> ConfigChange; }

The Configuration trait

There are four type of fields inside derived Configuration struct:

  1. #[config(skip)] field, these fields will not return by diff method and have not effect of update method
  2. #[config(hidden)] field, these fields have the same effect of #[config(skip)] field, in addition, these fields will not appear at the output of serializing Self::Encoder
  3. #[config(submodule)] field, these fields represent the submodule, and should also derive Configuration
  4. normal fields, the type of these fields should be implment Into and From for ConfigValue

Associated Types

type Encoder: Serialize[src]

Loading content...

Required methods

fn diff(&self, _: &Self) -> ConfigChange[src]

Compare to other config, return the difference

fn update(&mut self, _: ConfigChange)[src]

Update config with difference returned by diff

fn get_encoder(&'a self) -> Self::Encoder[src]

Get encoder that can be serialize with serde::Serializer with the disappear of #[config(hidden)] field

fn typed(&self) -> ConfigChange[src]

Get all fields and their type of the config

Loading content...

Implementors

Loading content...