Struct wallswitch::Config
source · pub struct Config {
pub desktop: String,
pub min_dimension: u64,
pub max_dimension: u64,
pub min_size: u64,
pub max_size: u64,
pub dirs: Vec<PathBuf>,
pub extensions: Vec<String>,
pub interval: u64,
pub monitor: u8,
pub sort: bool,
pub verbose: bool,
pub wallpaper: PathBuf,
}Expand description
Configuration variables
Fields§
§desktop: StringDesktops: gnome, xfce, openbox, …
min_dimension: u64Minimum dimension
max_dimension: u64Maximum dimension
min_size: u64Minimum file size
max_size: u64Maximum file size
dirs: Vec<PathBuf>Directory containing image files
extensions: Vec<String>Image file extension (identify -list format)
interval: u64Interval (in seconds) between each wallpaper displayed
monitor: u8Set the number of monitors.
sort: boolSort the images found.
verbose: boolShow intermediate runtime messages.
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