feat: derive macro for loading a cosmic-config

This commit is contained in:
Ashley Wulber 2023-05-19 15:36:15 -04:00
parent f433b3dc20
commit 76fd9207e5
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
5 changed files with 98 additions and 2 deletions

View file

@ -7,6 +7,9 @@ use std::{
sync::Mutex,
};
#[cfg(feature = "macro")]
pub use cosmic_config_derive;
#[cfg(feature = "calloop")]
pub mod calloop;
@ -251,3 +254,9 @@ impl<'a> ConfigSet for ConfigTransaction<'a> {
Ok(())
}
}
pub trait CosmicConfigEntry where Self: Sized + Default {
fn write_entry(&self, config: &Config) -> Result<(), crate::Error>;
fn get_entry(config: &Config) -> Result<Self, (Vec<crate::Error>, Self)>;
}