Struct wallswitch::Config
source · pub struct Config {
pub desktop: String,
pub dimension: u32,
pub dirs: Vec<PathBuf>,
pub extensions: Vec<String>,
pub interval: u32,
pub wallpaper: PathBuf,
}Expand description
Configuration variables
Fields§
§desktop: StringDesktops: gnome, xfce, openbox, …
dimension: u32Minimum dimension
dirs: Vec<PathBuf>Directory containing image files
extensions: Vec<String>Image file extension
interval: u32Interval (in seconds) between each wallpaper displayed
wallpaper: PathBufWallpaper file path used by gnome desktop
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
- set_command_line_arguments
- validate_config
- write_config_file
At the end add or update config file.
sourcepub fn validate_config(self) -> Result<Self, WSError<'static>>
pub fn validate_config(self) -> Result<Self, WSError<'static>>
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”
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