blob: f338e84eecd9636b279692d2fdf802c5411567ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#[macro_use]
extern crate lazy_static;
extern crate config_maint;
use std::error::Error;
use std::sync::RwLock;
use config_maint::Config;
lazy_static! {
static ref SETTINGS: RwLock<Config> = RwLock::new(Config::default());
}
fn try_main() -> Result<(), Box<dyn Error>> {
// Set property
SETTINGS.write()?.set("property", 42)?;
// Get property
println!("property: {}", SETTINGS.read()?.get::<i32>("property")?);
Ok(())
}
fn main() {
try_main().unwrap()
}
|