pub struct Config {
pub host: HostConfig,
pub recall: RecallConfig,
pub shell: ShellConfig,
pub history: HistoryConfig,
}Expand description
Main configuration struct
Fields§
§host: HostConfig§recall: RecallConfig§shell: ShellConfig§history: HistoryConfigImplementations§
Source§impl Config
impl Config
Sourcepub fn load() -> Self
pub fn load() -> Self
Load configuration from the default path, warning about a file that cannot be parsed.
Sourcepub fn load_quiet() -> Self
pub fn load_quiet() -> Self
Load configuration from the default path without printing anything. The shell hooks run on every prompt with stderr on the terminal; a config they cannot parse must not warn once per command.
fn load_from_default_path(warn: bool) -> Option<Self>
Sourcepub fn has_parse_error() -> bool
pub fn has_parse_error() -> bool
Returns true if the config file exists but fails to parse. Used to prevent migrate_host_settings from overwriting a corrupt config.
pub fn default_config_path() -> Option<PathBuf>
pub fn load_from_path(path: &Path) -> Option<Self>
fn read_from_path(path: &Path, warn: bool) -> Option<Self>
Sourcepub fn update_default_config(updates: &[(&str, Item)]) -> Result<()>
pub fn update_default_config(updates: &[(&str, Item)]) -> Result<()>
Update the config file at the default path, preserving existing content. Each update is a (dotted_key, value) pair, e.g. (“host.hostname”, value).
pub fn update_config_at_path( path: &PathBuf, updates: &[(&str, Item)], ) -> Result<()>
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
impl StructuralPartialEq for Config
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more