pub struct Config {
pub presets: HashMap<String, PresetConfig>,
}Expand description
Represents the user config file.
Fields§
§presets: HashMap<String, PresetConfig>Implementations§
source§impl Config
impl Config
sourcepub fn from_opt_path(path: Option<&str>) -> Result<Self>
pub fn from_opt_path(path: Option<&str>) -> Result<Self>
Tries to create a config from an optional path.
sourcepub fn get_preset(&self, name: &str) -> Result<PresetConfig>
pub fn get_preset(&self, name: &str) -> Result<PresetConfig>
Finds the preset configuration associated to the given name. If no preset found, returns an error.
sourcepub fn path() -> Option<PathBuf>
pub fn path() -> Option<PathBuf>
Tries to return a config path from a few default settings.
Tries paths in this order:
"$XDG_CONFIG_DIR/comodoro/config.toml"(or equivalent to$XDG_CONFIG_DIRin other OSes.)"$HOME/.config/comodoro/config.toml""$HOME/.comodororc"
Returns Some(path) if the path exists, otherwise None.
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 PartialEq for Config
impl PartialEq 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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.