pub struct ConfigSettings {
config_name: ConfigName,
app_name: String,
interactivity: ConfigInteractivity,
}
Expand description
The settings for a Config
Settings contain the ConfigName
by which the configuration file is loaded and stored, the
application name which uses the configuration (and also influences the file path of the
configuration) and the interactivity setting, which defines whether missing items are prompted
for interactively or not.
Fields§
§config_name: ConfigName
The configuration name (file name without suffix)
app_name: String
The name of the application using a Config
interactivity: ConfigInteractivity
The interactivity setting for the Config
(and any DeviceConfig
used by it)
Implementations§
Source§impl ConfigSettings
impl ConfigSettings
Sourcepub fn new(
app_name: String,
interactivity: ConfigInteractivity,
config_name: Option<ConfigName>,
) -> Self
pub fn new( app_name: String, interactivity: ConfigInteractivity, config_name: Option<ConfigName>, ) -> Self
Creates a new ConfigSettings
§Examples
use nethsm_config::{ConfigInteractivity, ConfigSettings};
// settings for an application called "my_app", that uses a custom configuration file named "my_app-config" interactively
let config_settings = ConfigSettings::new(
"my_app".to_string(),
ConfigInteractivity::Interactive,
Some("my_app-config".parse()?),
);
// settings for an application called "my_app", that uses a default config file non-interactively
let config_settings = ConfigSettings::new(
"my_app".to_string(),
ConfigInteractivity::NonInteractive,
None,
);
Sourcepub fn config_name(&self) -> ConfigName
pub fn config_name(&self) -> ConfigName
Returns the configuration name
Sourcepub fn interactivity(&self) -> ConfigInteractivity
pub fn interactivity(&self) -> ConfigInteractivity
Returns the interactivity setting
Trait Implementations§
Source§impl Clone for ConfigSettings
impl Clone for ConfigSettings
Source§fn clone(&self) -> ConfigSettings
fn clone(&self) -> ConfigSettings
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ConfigSettings
impl Debug for ConfigSettings
Source§impl Default for ConfigSettings
impl Default for ConfigSettings
Source§fn default() -> ConfigSettings
fn default() -> ConfigSettings
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ConfigSettings
impl<'de> Deserialize<'de> for ConfigSettings
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 PartialEq for ConfigSettings
impl PartialEq for ConfigSettings
Source§impl Serialize for ConfigSettings
impl Serialize for ConfigSettings
impl Eq for ConfigSettings
impl StructuralPartialEq for ConfigSettings
Auto Trait Implementations§
impl Freeze for ConfigSettings
impl RefUnwindSafe for ConfigSettings
impl Send for ConfigSettings
impl Sync for ConfigSettings
impl Unpin for ConfigSettings
impl UnwindSafe for ConfigSettings
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.