fn count_pairs(pattern: &dyn Deref<Target = [char]>) -> HashMap<[char; 2], u64> {
    let mut pairs: HashMap<[char; 2], u64> = HashMap::new();

    let mut it = pattern.iter();

    let mut prevchar = it.next().expect("need at least one character");
    while let Some(nextchar) = it.next() {
        let v: [char; 2] = [*prevchar, *nextchar];
        inc_with(&mut pairs, v, 1);
        prevchar = nextchar;
    }
    return pairs;
}
// TODO: use IntoIter instread of Deref of [T] to get iter
use IntoIter instread of Deref of [T] to get iter
use IntoIter instread of Deref of [ T ] to get iter
fn count_pairs(pattern: &dyn Deref<Target = [char]>) -> HashMap<[char; 2], u64> {
    let mut pairs: HashMap<[char; 2], u64> = HashMap::new();
    let mut it = pattern.iter();
    let mut prevchar = it.next().expect("need at least one character");
    while let Some(nextchar) = it.next() {
        let v: [char; 2] = [*prevchar, *nextchar];
        inc_with(&mut pairs, v, 1);
        prevchar = nextchar;
    }
    return pairs;
}
fn count_pairs ( pattern : & dyn Deref < Target = [ char ] > ) -> HashMap < [ char ; 2 ] , u64 > { let mut pairs : HashMap < [ char ; 2 ] , u64 > = HashMap :: new ( ) ; let mut it = pattern . iter ( ) ; let mut prevchar = it . next ( ) . expect ( " " ) ; while let Some ( nextchar ) = it . next ( ) { let v : [ char ; 2 ] = [ * prevchar , * nextchar ] ; inc_with ( & mut pairs , v , 1 ) ; prevchar = nextchar ; } return pairs ; }
TODO: use IntoIter instread of Deref of [T] to get iter
TODO : use IntoIter instread of Deref of [ T ] to get iter
pattern
&dyn Deref<Target = [char]>
pattern
&dyn Deref<Target = [char]>