#dict #record #map #any

string_map

Create a record to store any type of value

6 releases (breaking)

0.4.1 Mar 9, 2020
0.4.0 Mar 9, 2020
0.3.0 Mar 3, 2020
0.2.0 Mar 3, 2020
0.0.1 Mar 3, 2020

#11 in #dict

MPL-2.0 license

6KB
105 lines

StringMap

Create a record to store any type of value

Basic Usage

extern crate string_map;

use string_map::StringMap;

#[test]
fn main() {
    let mut dict = StringMap::new();
    dict.insert("number", 0);
    dict.insert("string", "str");
    dict.insert("boolean", true);

    debug_assert_eq!(dict.get("number"), Some(&0));
    debug_assert_eq!(dict.get_mut("string"), Some(&mut "str"));
    debug_assert_eq!(dict.get_key_value("boolean"), Some(("boolean", &true)));
}

No runtime deps