Struct wallswitch::Config
source · pub struct Config {
pub interval: u64,
pub min_dimension: u32,
pub wallpaper: PathBuf,
pub desktop: String,
pub dirs: Vec<String>,
}Expand description
Configuration variables
Fields§
§interval: u64§min_dimension: u32§wallpaper: PathBuf§desktop: String§dirs: Vec<String>Implementations§
source§impl Config
impl Config
sourcepub fn new(args: &Arguments) -> MyResult<Self>
pub fn new(args: &Arguments) -> MyResult<Self>
Read command line arguments with priority order:
- read config file || read default config
- get_command_line_arguments
- validate_config
- write_config_file
At the end add or update config file.
sourcepub fn validate_config(self) -> Result<Self, WSError>
pub fn validate_config(self) -> Result<Self, WSError>
Validate configuration
sourcepub fn write_config_file(
self,
path: &PathBuf,
read_default_config: bool,
) -> MyResult<Self>
pub fn write_config_file( self, path: &PathBuf, read_default_config: bool, ) -> MyResult<Self>
Write config file path:: “/home/user_name/.config/wallswitch/wallswitch.json”
cat wallswitch.json | jq
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