Macro stry_common::vecmap [−][src]
Create a VecMap from a list of key-value pairs.
While based off of maplit, this is an
extended version with the ability to enable a strict mode.
Examples
let map = fenn::vecmap! { "a" => 1, "b" => 2, }; assert_eq!(map["a"], 1); assert_eq!(map["b"], 2); assert_eq!(map.get("c"), None);
When strict mode is active, a duplicate key will cause a panic.
ⓘ
let map = fenn::vecmap! { strict, data = { "a" => 1, "a" => 2, // panics } };