Struct timelog::config::Config

source ·
pub struct Config { /* private fields */ }
Expand description

Type specifying the configuration for the timelog program.

Implementations§

source§

impl Config

source

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
source

pub fn from_file(filename: &str) -> Result<Self>

Create a new Config object from the supplied config file

Errors
source

pub fn configfile(&self) -> &str

Return a String containing the name of the config file.

source

pub fn dir(&self) -> &str

Return the path of the directory that stores the log and stack files

source

pub fn set_dir(&mut self, dir: &str)

Set the path of the directory that stores the log and stack files

source

pub fn editor(&self) -> &str

Return the path to the editor used with the edit command

source

pub fn set_editor(&mut self, editor: &str)

Set the path to the editor used with the edit command

source

pub fn browser(&self) -> &str

The path to the browser used with the chart command

source

pub fn set_browser(&mut self, browser: &str)

The path to the browser used with the chart command

source

pub fn defcmd(&self) -> &str

Return the default command if none is entered

source

pub fn logfile(&self) -> String

The file containing the timelog entries

source

pub fn stackfile(&self) -> String

The file that holds the stack

source

pub fn reportfile(&self) -> String

The file containing the timelog entries

source

pub fn create(&self) -> Result<(), PathError>

Write the configuration to disk in the file specified by the Config

Errors
source

pub fn alias_names(&self) -> impl Iterator<Item = &String>

Return an iterator over the alias names

source

pub fn alias(&self, key: &str) -> Option<&str>

Retrieve the value associate with the named alias, if one exists.

Trait Implementations§

source§

impl Clone for Config

source§

fn clone(&self) -> Config

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Config

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Config

source§

fn default() -> Self

Create a Config with all of the default parameters.

Panics

If any of the default valures are not legal in the current system, the code will panic. These is a programmer-specified defaults, and should never fail.

source§

impl PartialEq<Config> for Config

source§

fn eq(&self, other: &Config) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Config

source§

impl StructuralEq for Config

source§

impl StructuralPartialEq for Config

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.