cosmic-config: Add new_state constructor for storing state

This commit is contained in:
Jeremy Soller 2023-10-09 09:22:17 -06:00
parent 50cc1d2975
commit f0005165f3
2 changed files with 44 additions and 3 deletions

View file

@ -3,9 +3,7 @@
use cosmic_config::{Config, ConfigGet, ConfigSet};
pub fn main() {
let config = Config::new("com.system76.Example", 1).unwrap();
fn test_config(config: Config) {
let watcher = config
.watch(|config, keys| {
println!("Changed: {:?}", keys);
@ -83,3 +81,11 @@ pub fn main() {
println!("Committing transaction");
println!("Commit transaction: {:?}", tx.commit());
}
pub fn main() {
println!("Testing config");
test_config(Config::new("com.system76.Example", 1).unwrap());
println!("Testing state");
test_config(Config::new_state("com.system76.Example", 1).unwrap());
}