cosmic-config: Add new_state constructor for storing state
This commit is contained in:
parent
50cc1d2975
commit
f0005165f3
2 changed files with 44 additions and 3 deletions
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue