Look back during iterating array
.trim_left().trim_right() is just .trim().
You might as well inline str_iter, since you only use it in one place. At least move it closer to the use-point.
Folds aren't the idiomatic loop primitive in Rust. In this case it would be much nicer to just use for.


This improves compiler analysis, and you find out that digit's initial assignment isn't getting read. You don't need digit outside the loop at all, and thus it doesn't even need to be mutable.

You're using too many type annotations. The one as usize after to_digit is enough, and even if you did need to annotate the others you should use let last: usize = 1 or let last = 1usize. Similarly, let the Vec's type parameter be inferred.
Your brace formatting is not Rusty.
Instead of dealing with window, just run two zipped offset parallel iterators. Indices work fine, too, and aren't unidiomatic: clearer, efficient code is always idiomatic.