pub struct Config { /* private fields */ }Implementations§
source§impl Config
impl Config
sourcepub fn new(
kill_time: u8,
work_time: u16,
password: String,
processes: HashSet<String>
) -> Self
pub fn new(
kill_time: u8,
work_time: u16,
password: String,
processes: HashSet<String>
) -> Self
Creates a new config from the parameters
sourcepub fn get_or_create(file: Option<PathBuf>) -> (Config, PathBuf)
pub fn get_or_create(file: Option<PathBuf>) -> (Config, PathBuf)
Get the config object from the config.yaml file.
Panics
- if access to the file is compromised anywhere in it’s path. Lack of access to the config directory is distinguished from lack of access to the file
pub fn write_config(&self, filename: &Path)
sourcepub fn contains(&self, proc: &str) -> bool
pub fn contains(&self, proc: &str) -> bool
Returns true if process is in process list, otherwise it returns false.
sourcepub fn get_work_time(&self) -> Duration
pub fn get_work_time(&self) -> Duration
returns a Duration from the work_time. It transforms from minutes to seconds
pub fn get_work_time_as_min(&self) -> u16
pub fn get_kill_time(&self) -> Duration
pub fn get_kill_time_as_seconfs(&self) -> u8
pub fn print_curr_state(&self)
pub fn edit(self) -> Config
pub fn remain(&self, beg: Instant) -> Config
pub fn add_time(&self, time: u8) -> Config
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
source§impl GuessablePassword for Config
impl GuessablePassword for Config
source§fn get_password(&self) -> String
fn get_password(&self) -> String
The field must be accessible to the trait through this method.