pub struct Config {
pub base_url: String,
pub oauth_client_id: String,
pub cache_dir: PathBuf,
pub cache_enabled: bool,
}Expand description
What a client needs to know before it can talk to HEY.
Fields§
§base_url: StringWhere HEY is: DEFAULT_BASE_URL, or a HEY running on this machine.
oauth_client_id: StringThe OAuth client to sign in as.
cache_dir: PathBufWhere the response cache keeps its files.
cache_enabled: boolWhether JSON reads are cached on disk between runs.
Implementations§
Source§impl Config
impl Config
Sourcepub fn load(path: &Path) -> Result<Config, Error>
pub fn load(path: &Path) -> Result<Config, Error>
Reads a JSON config file over the defaults. A missing file answers the defaults.
Sourcepub fn with_env(self) -> Config
pub fn with_env(self) -> Config
Lets HEY_BASE_URL, HEY_OAUTH_CLIENT_ID, HEY_CACHE_DIR and HEY_CACHE_ENABLED
override whatever is set. An empty variable counts as unset.
Sourcepub fn with_base_url(self, base_url: impl Into<String>) -> Config
pub fn with_base_url(self, base_url: impl Into<String>) -> Config
Points the client at another HEY, such as one running on this machine.
Sourcepub fn with_cache_enabled(self, enabled: bool) -> Config
pub fn with_cache_enabled(self, enabled: bool) -> Config
Turns the on-disk response cache on or off.
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 Eq for Config
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.