pub struct Config { /* private fields */ }Implementations
sourceimpl 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
sourceimpl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
sourcefn 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
sourceimpl GuessablePassword for Config
impl GuessablePassword for Config
sourcefn get_password(&self) -> String
fn get_password(&self) -> String
The field must be accessible to the trait through this method.
impl StructuralPartialEq for Config
Auto Trait Implementations
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more