pub enum ConfigValue {
Integer(i64, Definition),
String(String, Definition),
List(Vec<ConfigValue>, Definition),
Table(HashMap<String, ConfigValue>, Definition),
Boolean(bool, Definition),
}Expand description
Similar to [toml::Value] but includes the source location where it is defined.
Variants§
Integer(i64, Definition)
String(String, Definition)
List(Vec<ConfigValue>, Definition)
Table(HashMap<String, ConfigValue>, Definition)
Boolean(bool, Definition)
Implementations§
Source§impl ConfigValue
impl ConfigValue
pub fn from_toml(def: Definition, toml: Value) -> Result<ConfigValue>
fn from_toml_inner( def: Definition, toml: Value, path: &mut Vec<KeyOrIdx>, ) -> Result<ConfigValue>
pub fn into_toml(self) -> Value
Sourcepub fn merge(&mut self, from: ConfigValue) -> Result<()>
pub fn merge(&mut self, from: ConfigValue) -> Result<()>
Merge the given value into self.
Rules:
- Tables merge recursively.
- Prefer the higher-priority definition, keeping the existing value on a tie.
- For mergeable lists, retain both sides, ordered by definition priority, and incoming entries come first among entries of equal priority.
- Container and non-container types cannot be mixed (yet).
fn merge_helper( &mut self, from: ConfigValue, parts: &mut ConfigKey, ) -> Result<()>
pub fn i64(&self, key: &str) -> Result<(i64, &Definition)>
pub fn string(&self, key: &str) -> Result<(&str, &Definition)>
pub fn table( &self, key: &str, ) -> Result<(&HashMap<String, ConfigValue>, &Definition)>
pub fn table_mut( &mut self, key: &str, ) -> Result<(&mut HashMap<String, ConfigValue>, &mut Definition)>
pub fn is_table(&self) -> bool
pub fn string_list(&self, key: &str) -> Result<Vec<(String, Definition)>>
pub fn boolean(&self, key: &str) -> Result<(bool, &Definition)>
pub fn desc(&self) -> &'static str
pub fn definition(&self) -> &Definition
pub(crate) fn expected<T>(&self, wanted: &str, key: &str) -> Result<T>
Trait Implementations§
Source§impl Clone for ConfigValue
impl Clone for ConfigValue
Source§impl Debug for ConfigValue
impl Debug for ConfigValue
impl Eq for ConfigValue
Source§impl PartialEq for ConfigValue
impl PartialEq for ConfigValue
impl StructuralPartialEq for ConfigValue
Auto Trait Implementations§
impl Forget for ConfigValue
impl Freeze for ConfigValuewhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<ConfigValue>: Freeze,
PhantomData<(String, ConfigValue)>: Freeze,
impl Move for ConfigValue
impl RefUnwindSafe for ConfigValue
impl Send for ConfigValue
impl Sync for ConfigValue
impl Unpin for ConfigValue
impl UnsafeUnpin for ConfigValuewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<ConfigValue>: UnsafeUnpin,
PhantomData<(String, ConfigValue)>: UnsafeUnpin,
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
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
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 72 bytes
Size for each variant:
Integer: 56 bytesString: 72 bytesList: 72 bytesTable: 72 bytesBoolean: 56 bytes