Struct stackedconfig::ConfigStack [] [src]

pub struct ConfigStack { /* fields omitted */ }

Combines multiple serde_json::Value objects together so they can be queried as a single, nested object.

Supports using a custom separator if desired for path style queries. Defaults to a forward slash /.

Methods

impl ConfigStack
[src]

Create a new ConfigStack

Returns a new ConfigStack with the given separator

let conf = ConfigStack::new().with_path_sep('.').push(v1).push(v2);
let val = conf.get("foo.bar.baz");

Adds a new configuration value to the stack. The added value becomes the highest priority value on the stack.

Removes the top level configuration from the stack and returns it. The opposite of push. If no configurations are on the stack then None is returned.

Looks up a value at the given path

conf.get("foo/bar/baz") -> Lookup::Found(Value::Bool(true))
conf.get("foo/bar/qux") -> Lookup::Missing

Looks up a value at the given path where the path is a Vec<String>. No parsing is performed on the path parts, so this method will not split on the path separator.

Trait Implementations

impl Debug for ConfigStack
[src]

Formats the value using the given formatter.