pub struct Settings {
pub log_level: String,
pub overwrite: bool,
pub debug_model: bool,
}Expand description
Program settings from config file
NOTE: If you add or change a field in this struct, you must also update the schema in
schemas/settings.yaml.
Fields§
§log_level: StringThe default program log level
overwrite: boolWhether to overwrite output files by default
debug_model: boolWhether to write additional information to CSV files
Implementations§
Source§impl Settings
impl Settings
Sourcepub fn load() -> Result<Settings>
pub fn load() -> Result<Settings>
Read the contents of a settings file from the model directory.
If the file is not present, default values for settings will be used
§Returns
The program settings as a Settings struct or an error if the file is invalid
Sourcefn load_from_path(file_path: &Path) -> Result<Settings>
fn load_from_path(file_path: &Path) -> Result<Settings>
Read from the specified path, returning
Sourcepub fn default_file_contents() -> String
pub fn default_file_contents() -> String
The contents of the default settings file
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
Source§impl DocumentedFields for Settings
impl DocumentedFields for Settings
Source§const FIELD_NAMES: &'static [&'static str]
const FIELD_NAMES: &'static [&'static str]
Field names, as accepted by [
Self::get_field_docs]. Read moreSource§const FIELD_DOCS: &'static [&'static str]
const FIELD_DOCS: &'static [&'static str]
The static doc comments on each field or variant of this type, indexed
by field/variant order.
impl StructuralPartialEq for Settings
Auto Trait Implementations§
impl Freeze for Settings
impl RefUnwindSafe for Settings
impl Send for Settings
impl Sync for Settings
impl Unpin 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> 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