[][src]Module figment::util

Useful functions and macros for writing figments.

map! macro

The map! macro constructs a Map from key-value pairs and is particularly useful during testing:

use figment::util::map;

let map = map! {
    "name" => "Bob",
    "age" => "100"
};

assert_eq!(map.get("name"), Some(&"Bob"));
assert_eq!(map.get("age"), Some(&"100"));

let map = map! {
    100 => "one hundred",
    23 => "twenty-three"
};

assert_eq!(map.get(&100), Some(&"one hundred"));
assert_eq!(map.get(&23), Some(&"twenty-three"));

Re-exports

pub use map;

Modules

vec_tuple_map

A helper to serialize and deserialize a map as a vector of (key, value) pairs.

Functions

bool_from_str_or_int

A helper to deserialize 0/false as false and 1/true as true.

diff_paths

A helper function to determine the relative path to path from base.