pub struct Config {
pub style: Option<Style>,
pub volume: Option<f32>,
pub times: Option<u32>,
}Expand description
Persisted configuration for the tool.
Fields§
§style: Option<Style>Default horn style.
volume: Option<f32>Default volume, 0.0 to 1.0.
times: Option<u32>Default number of honks, 1 to 10.
Implementations§
Source§impl Config
impl Config
Sourcepub fn config_path() -> Result<PathBuf>
pub fn config_path() -> Result<PathBuf>
Return the path to the config file, creating no files.
HONK_CONFIG_DIR overrides the directory (used by tests and power users).
Otherwise Linux and macOS use $XDG_CONFIG_HOME/honk or ~/.config/honk,
the same rule as Ailloy; Windows uses %APPDATA%\honk.
Sourcepub fn load() -> Result<Self>
pub fn load() -> Result<Self>
Load the config from disk. Returns Config::default if no file exists yet.
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
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin 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