pub struct ConfigBuilder {
pub session_id: Option<String>,
pub puzzle_dir: Option<PathBuf>,
pub sessions_dir: Option<PathBuf>,
pub passphrase: Option<String>,
pub fake_time: Option<DateTime<Utc>>,
}Expand description
A builder interface for specifying configuration settings to the Advent of Client client. Configuration settings have sensible default values, and should only be changed when the user wants custom behavior.
§Default Values
session_id: The user’s Advent of Code session cookie. This is required for getting input and submitting answers.passphrase: The hostname of the current machine. A custom passphrase is required ifpuzzle_diris changed.puzzle_dir: A directory in the local user’s cache dir (e.g., XDG_CACHE_HOME on Linux).sessions_dir: A directory in the local user’s cache dir (e.g., XDG_CACHE_HOME on Linux).
Fields§
§session_id: Option<String>§puzzle_dir: Option<PathBuf>§sessions_dir: Option<PathBuf>§passphrase: Option<String>§fake_time: Option<DateTime<Utc>>Implementations§
Source§impl ConfigBuilder
impl ConfigBuilder
Sourcepub fn use_toml(self, config_text: &str) -> Result<Self, ConfigError>
pub fn use_toml(self, config_text: &str) -> Result<Self, ConfigError>
Loads configuration values from string containing TOML formatted text. Configuration values loaded here will overwrite previously loaded values.
pub fn with_session_id<S: Into<String>>(self, session_id: S) -> Self
pub fn with_puzzle_dir<P: Into<PathBuf>>(self, puzzle_dir: P) -> Self
pub fn with_sessions_dir<P: Into<PathBuf>>(self, sessions_dir: P) -> Self
pub fn with_passphrase<S: Into<String>>(self, passphrase: S) -> Self
pub fn with_fake_time(self, fake_time: DateTime<Utc>) -> Self
Sourcepub fn build(self) -> Result<Config, ConfigError>
pub fn build(self) -> Result<Config, ConfigError>
Generate a Config object from the settings in this ConfigBuilder object.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConfigBuilder
impl RefUnwindSafe for ConfigBuilder
impl Send for ConfigBuilder
impl Sync for ConfigBuilder
impl Unpin for ConfigBuilder
impl UnwindSafe for ConfigBuilder
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