hashmap_to_hashmap 0.9.0

Adds a method .map to HashMap that maps to another HashMap
Documentation
  • Coverage
  • 0%
    0 out of 3 items documented0 out of 2 items with examples
  • Size
  • Source code size: 3.85 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.06 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • bradurani/rust-hashmap-to-hashmap
    2 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • bradurani

HashMap to HashMap

Adds a method .map to HashMap that maps to another HashMap


        let brad = Person {
            id: 1,
            first_name: "Brad",
            last_name: "Urani",
        };
        let susan = Person {
            id: 2,
            first_name: "Susan",
            last_name: "Urani",
        };
        let mut h: HashMap<i32, Person> = HashMap::new();
        h.insert(12, brad);
        h.insert(29, susan);

        let new_map = h.map(|k, v| v.id,
                            |k, v| k.to_string() + &"-" + &v.first_name + &" " + &v.last_name);
        // { 1: "12-Brad Urani", 2: "29-Susan Urani" }