pub struct Configuration {
pub mqtt: Mqtt,
pub sensors: Sensors,
pub log_verbosity: usize,
}
Expand description
Contains all the configuration for mqtt-system-monitor
Fields§
§mqtt: Mqtt
Contains the configuration for communicating with the MQTT broker
sensors: Sensors
Contains the configuration for the sensors
log_verbosity: usize
Sets the verbosity of the logs.
- 1 => Error
- 2 => Warning
- 3 => Info
- 4 => Debug
- 5 => Trace
Implementations§
Source§impl Configuration
impl Configuration
Sourcepub fn load(path: &str) -> Result<Configuration, Box<dyn Error>>
pub fn load(path: &str) -> Result<Configuration, Box<dyn Error>>
Load the configuration from a file
§Example
use mqtt_system_monitor::{configuration, Configuration};
let config = Configuration::load("conf/mqtt-system-monitor.conf").expect("Cannot load configuration");
assert_eq!(config.mqtt.host, "localhost");
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Configuration
impl<'de> Deserialize<'de> for Configuration
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Configuration
impl RefUnwindSafe for Configuration
impl Send for Configuration
impl Sync for Configuration
impl Unpin for Configuration
impl UnwindSafe for Configuration
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more