lorust 0.2.0

Modern Rust utility library delivering modularity, performance & extras; or simply Rust version of Lodash
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/// Sets the value at `key` of `object`. If the `key` doesn't exist,
/// it's created.
///
/// **Note:** This function mutates `object`.
///
/// # Examples
///
/// ```
/// use lorust::set;
/// use std::collections::HashMap;
///
/// let mut object: HashMap<String, String> = HashMap::new();
/// set(&mut object, "key", "value");
/// assert_eq!(object.get("key").unwrap(), "value");
/// ```
pub fn set(object: &mut std::collections::HashMap<String, String>, key: &str, value: &str) {
    object.insert(key.to_string(), value.to_string());
}