preftool 0.1.0

Configuration library for CLI tools/servers.
Documentation
use crate::Configuration;

/// Settings struct that can be bound by configuration.
pub trait Settings {
  /// Bind values in self from configuration.
  fn bind<C>(&mut self, config: C)
  where
    C: Configuration;

  /// Get a new settings value from configuration.
  fn get<C>(config: C) -> Self
  where
    C: Configuration,
    Self: Default,
  {
    let mut ret = Self::default();
    Self::bind(&mut ret, config);
    ret
  }
}