I'm trying to decode a digit to an integer and either get an iterator over just this digit or an empty iterator if it wasn't a digit. I tried to do it like that:
let ch = '1';
ch.to_digit(10).map(once).unwrap_or(empty())
This doesn't compile. I get the following error message:
error[E0308]: mismatched types
 --> src/lib.rs:6:41
  |
6 |     ch.to_digit(10).map(once).unwrap_or(empty());
  |                                         ^^^^^^^ expected struct `std::iter::Once`, found struct `std::iter::Empty`
error[E0308]: mismatched types
 --> src/lib.rs:6:41
  |
6 |     ch.to_digit(10).map(once).unwrap_or(empty());
  |                                         ^^^^^^^ expected struct `std::iter::Once`, found struct `std::iter::Empty`
  |
  |
  = note: expected type `std::iter::Once<u32>`
             found type `std::iter::Empty<_>`
  = note: expected type `std::iter::Once<u32>`
             found type `std::iter::Empty<_>`
I there any way to tell the .unwrap_or(...) that I don't care of the actual type, but just that I will get an implementation of Iterator?