Skip to main content

ConfigObject

Trait ConfigObject 

Source
pub trait ConfigObject<V>: Sized + IntoIterator<Item = (String, V)> {
    // Required methods
    fn new() -> Self;
    fn iter<'a>(&'a self) -> impl Iterator<Item = (&'a String, &'a V)>
       where V: 'a;
    fn get(&self, key: &str) -> Option<&V>;
    fn get_mut(&mut self, key: &str) -> Option<&mut V>;
    fn insert(&mut self, key: String, value: V);
}
Expand description

An ordered object whose children have the same native value type.

Required Methods§

Source

fn new() -> Self

Construct an empty object.

Source

fn iter<'a>(&'a self) -> impl Iterator<Item = (&'a String, &'a V)>
where V: 'a,

Iterate in input/insertion order.

Source

fn get(&self, key: &str) -> Option<&V>

Look up a child by key.

Source

fn get_mut(&mut self, key: &str) -> Option<&mut V>

Look up a child for replacement or recursion.

Source

fn insert(&mut self, key: String, value: V)

Insert a child, preserving an existing key’s position.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ConfigObject<Value> for Map<String, Value>

Source§

fn new() -> Self

Source§

fn iter<'a>(&'a self) -> impl Iterator<Item = (&'a String, &'a Value)>
where Value: 'a,

Source§

fn get(&self, key: &str) -> Option<&Value>

Source§

fn get_mut(&mut self, key: &str) -> Option<&mut Value>

Source§

fn insert(&mut self, key: String, value: Value)

Source§

impl ConfigObject<Value> for Table

Source§

fn new() -> Self

Source§

fn iter<'a>(&'a self) -> impl Iterator<Item = (&'a String, &'a Value)>
where Value: 'a,

Source§

fn get(&self, key: &str) -> Option<&Value>

Source§

fn get_mut(&mut self, key: &str) -> Option<&mut Value>

Source§

fn insert(&mut self, key: String, value: Value)

Implementors§