pub struct Config {
pub esp: EspConfig,
pub mqtt: Option<MqttConfig>,
pub sensors: Vec<SensorConfig>,
pub wifi: Option<WifiConfig>,
}
Fields§
§esp: EspConfig
§mqtt: Option<MqttConfig>
§sensors: Vec<SensorConfig>
§wifi: Option<WifiConfig>
Implementations§
Source§impl Config
impl Config
Sourcepub fn check(config: &str) -> Result<(), ConfigError>
pub fn check(config: &str) -> Result<(), ConfigError>
Checks configuration file validity.
use oxide_spark_utils::config::Config;
let config = r#"
[esp]
id = "esp1"
log_level = "Error"
"#;
let erroneous_config = r#"
[esp]
id = "esp1"
log_level = "Unknown"
"#;
assert!(matches!(Config::check(config), Ok(())));
assert!(matches!(Config::check(erroneous_config), Err(_)));
pub fn set(file: &'static str)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
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 Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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