79109967

Date: 2024-10-21 12:11:41
Score: 1
Natty:
Report link

Itertools also has counts for convenience:

use itertools::Itertools;

fn main() {
    let word = "Barbara";
    let map1 = word
        .to_lowercase()
        .chars()
        .counts();
    println!("{:?}", map1);
}

Output:

{'a': 3, 'r': 2, 'b': 2}

Playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021

Docs: https://docs.rs/itertools/latest/itertools/trait.Itertools.html#method.counts

GitHub issue that made me aware of counts: https://github.com/rust-itertools/itertools/issues/599

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: user7017793