pub struct Config { /* private fields */ }
Expand description
Type specifying the configuration for the timelog program.
Implementations§
source§impl Config
impl Config
sourcepub fn new(
config: &str,
dir: Option<&str>,
editor: Option<&str>,
browser: Option<&str>,
cmd: Option<&str>
) -> Result<Self>
pub fn new( config: &str, dir: Option<&str>, editor: Option<&str>, browser: Option<&str>, cmd: Option<&str> ) -> Result<Self>
Create a new Config
object with supplied parameters
Errors
- Return
PathError::InvalidConfigPath
if the configuration filename is not valid. - Return
PathError::InvalidTimelogPath
if the timelog directory is not valid.
sourcepub fn from_file(filename: &str) -> Result<Self>
pub fn from_file(filename: &str) -> Result<Self>
Create a new Config
object from the supplied config file
Errors
- Return
PathError::InvalidConfigPath
if the configuration filename is not valid. - Return
PathError::InvalidTimelogPath
if the timelog directory is not valid. - Return
PathError::FileAccess
if the config file is not accessible.
sourcepub fn configfile(&self) -> &str
pub fn configfile(&self) -> &str
Return a String
containing the name of the config file.
sourcepub fn set_dir(&mut self, dir: &str)
pub fn set_dir(&mut self, dir: &str)
Set the path of the directory that stores the log and stack files
sourcepub fn set_editor(&mut self, editor: &str)
pub fn set_editor(&mut self, editor: &str)
Set the path to the editor used with the edit
command
sourcepub fn set_browser(&mut self, browser: &str)
pub fn set_browser(&mut self, browser: &str)
The path to the browser used with the chart
command
sourcepub fn reportfile(&self) -> String
pub fn reportfile(&self) -> String
The file containing the timelog entries
sourcepub fn create(&self) -> Result<(), PathError>
pub fn create(&self) -> Result<(), PathError>
Write the configuration to disk in the file specified by the Config
Errors
- Return
PathError::FileAccess
if we are unable to write the configuration.
sourcepub fn alias_names(&self) -> impl Iterator<Item = &String>
pub fn alias_names(&self) -> impl Iterator<Item = &String>
Return an iterator over the alias names
Trait Implementations§
source§impl PartialEq<Config> for Config
impl PartialEq<Config> for Config
impl Eq for Config
impl StructuralEq for Config
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§
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