This, and the following `if`, could probably written as a single loop:

```rust
for (i, c) in us.iter().enumerate() {
    match c {
        '0'..'9' | 'A' .. 'F' | 'a' .. 'f' | '-' => {}
        _ => return Err(fmt!(...))
    }
}
```
Also, the `as char` cast on the byte below is wrong. It is converting the byte value to the character with that unicode codepoint, not that exact byte pattern, and so if this cuts a utf8 character, then it will print the wrong thing. It should probably print the unicode character (either using `.char_at`, or printing `c` directly in the loop above).