the trait bound `RangeInclusive<char>: FindToken<_>` is not satisfied
I am not sure if I am using the API incorrectly, or if I have found an edge case that's not yet implemented. I was hoping to be able to write something like this:
fn parser(s: &str) -> IResult<&str, Self> {
let (f, file) = nom::character::complete::one_of('a'..='h')(s)?;
let (r, rank) = nom::character::complete::one_of('1'..='8')(f)?;
Ok(Square { rank, file })
}
However, I can't pass in a char range to one_of. I am not quite sure what I should use as an alternative, other than enumerating the characters.
If you look at the definition of one_of, it takes a FindToken. There is not a FindToken implementation for any of the range types, only different kinds of slice and array types.
I had proposed range types but that was part of a larger effort that stalled out.
OK. I ended up using the predicate test, using the range contains method. But it is a bit verbose, and less declarative. Thanks.