pub struct Settings {
pub contact: Option<String>,
pub base_url: Option<String>,
pub timeout_seconds: Option<u64>,
pub plan_daily_limit: Option<u32>,
pub delay_threshold_minutes: Option<u32>,
}Expand description
The contents of the configuration file. Unset values take their default.
Fields§
§contact: Option<String>How Transitous can reach the operator: a URL, a mailto: URL or an
email address. Required for every request.
base_url: Option<String>§timeout_seconds: Option<u64>§plan_daily_limit: Option<u32>Raise only after agreeing on more with Transitous.
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 TRANSITOUS_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.
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 Settings
impl Sync for Settings
impl Unpin for Settings
impl UnsafeUnpin for Settings
impl UnwindSafe for Settings
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.