pub struct ConfigValue { /* private fields */ }
Expand description
A structure representing a config value.
Implementations§
Source§impl ConfigValue
impl ConfigValue
Sourcepub fn new(s: &str) -> ConfigResult<Self>
pub fn new(s: &str) -> ConfigResult<Self>
Parses a TOML-formatted string into a ConfigValue
.
Sourcepub fn new_with_type(s: &str, ty: &str) -> ConfigResult<Self>
pub fn new_with_type(s: &str, ty: &str) -> ConfigResult<Self>
Parses a TOML-formatted string into a ConfigValue
with a specified type.
Sourcepub fn ty(&self) -> Option<&ConfigType>
pub fn ty(&self) -> Option<&ConfigType>
Returns the type of the config value if it is specified on construction.
Sourcepub fn update(&mut self, new_value: Self) -> ConfigResult<()>
pub fn update(&mut self, new_value: Self) -> ConfigResult<()>
Updates the config value with a new value.
Sourcepub fn inferred_type(&self) -> ConfigResult<ConfigType>
pub fn inferred_type(&self) -> ConfigResult<ConfigType>
Returns the inferred type of the config value.
Sourcepub fn type_matches(&self, ty: &ConfigType) -> bool
pub fn type_matches(&self, ty: &ConfigType) -> bool
Returns whether the type of the config value matches the specified type.
Sourcepub fn to_toml_value(&self) -> String
pub fn to_toml_value(&self) -> String
Returns the TOML-formatted string of the config value.
Sourcepub fn to_rust_value(
&self,
ty: &ConfigType,
indent: usize,
) -> ConfigResult<String>
pub fn to_rust_value( &self, ty: &ConfigType, indent: usize, ) -> ConfigResult<String>
Returns the Rust code of the config value.
The indent
parameter specifies the number of spaces to indent the code.
Trait Implementations§
Source§impl Clone for ConfigValue
impl Clone for ConfigValue
Source§fn clone(&self) -> ConfigValue
fn clone(&self) -> ConfigValue
Returns a duplicate 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 moreAuto Trait Implementations§
impl Freeze for ConfigValue
impl RefUnwindSafe for ConfigValue
impl Send for ConfigValue
impl Sync for ConfigValue
impl Unpin for ConfigValue
impl UnwindSafe for ConfigValue
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