fn parse_human_dur(s: &str) -> Result<Duration, &'static str> {
    let mut tok = Tokenizer::new(s);
    let mut dur = Duration::from_secs(0);
    while !tok.done() {
        dur += get_dur(&mut tok)?;
    }
    Ok(dur)
}
// This could definitely be implemented with a regex, but I wanted to teach myself Rust iterators
// and pattern matching.
This could definitely be implemented with a regex, but I wanted to teach myself Rust iterators
and pattern matching.
This could definitely be implemented with a regex but I wanted to teach myself Rust iterators and pattern matching .
fn parse_human_dur(s: &str) -> Result<Duration, &'static str> {
    let mut tok = Tokenizer::new(s);
    let mut dur = Duration::from_secs(0);
    while !tok.done() {
        dur += get_dur(&mut tok)?;
    }
    Ok(dur)
}
fn parse_human_dur ( s : & str ) -> Result < Duration , & ' static str > { let mut tok = Tokenizer :: new ( s ) ; let mut dur = Duration :: from_secs ( 0 ) ; while ! tok . done ( ) { dur += get_dur ( & mut tok ) ? ; } Ok ( dur ) }
This could definitely be implemented with a regex, but I wanted to teach myself Rust iterators
and pattern matching.
This could definitely be implemented with a regex but I wanted to teach myself Rust iterators and pattern matching .
s
&str