pub struct Settings {
pub access_id: Option<String>,
pub base_url: Option<String>,
pub timeout_seconds: Option<u64>,
pub retries: Option<u32>,
pub delay_threshold_minutes: Option<u32>,
}Expand description
The contents of the configuration file. Unset values take their default.
Fields§
§access_id: Option<String>The access key of the RMV Open Data API. Required for every request.
base_url: Option<String>§timeout_seconds: Option<u64>§retries: Option<u32>§delay_threshold_minutes: Option<u32>Implementations§
Source§impl Settings
impl Settings
Sourcepub fn path(env: &impl Fn(&str) -> Option<String>) -> Option<PathBuf>
pub fn path(env: &impl Fn(&str) -> Option<String>) -> Option<PathBuf>
The file RMV_CONFIG names, else config.toml in dirs::config.
None if the home directory is unknown.
Sourcepub fn load(path: &Path) -> Result<Self, Error>
pub fn load(path: &Path) -> Result<Self, Error>
Reads the file, or returns empty settings if it does not exist.
Sourcepub fn save(&self, path: &Path) -> Result<(), Error>
pub fn save(&self, path: &Path) -> Result<(), Error>
Writes the file, creating its directory if needed. Replaces the file at once, so a failed write leaves the old one intact. On Unix only the owner can read it, as it holds the access key.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Settings
impl<'de> Deserialize<'de> for Settings
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 Settings
impl StructuralPartialEq for Settings
Auto Trait Implementations§
impl Forget for Settings
impl Freeze for Settings
impl Move for Settings
impl RefUnwindSafe for Settings
impl Send for Settingswhere
RawVecInner: Send,
impl Sync for Settingswhere
RawVecInner: Sync,
impl Unpin for Settings
impl UnsafeUnpin for Settings
impl UnwindSafe for Settingswhere
RawVecInner: UnwindSafe,
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.