Closed adamchalmers closed 1 year ago
While its not baked-in, you can support that by implementing ContainsToken
for your type.
For an example of this, see #348.
Now, there is the question of whether we should support some more blanket impls for ContainsToken
. The main loss is that you can't intermix bytes/chars as tokens. In particular, I have a parser that is generic over both.
@adamchalmers could you confirm that this is resolved?
LGTM!
Please complete the following tasks
rust version
1.73.0
winnow version
0.5.16
Minimal reproducible code
Steps to reproduce the bug with the above code
cargo check
Actual Behaviour
Expected Behaviour
It should compile and allow me to take the first two tokens, while rejecting the third.
Additional Context
I think this is because
trait ContainsTokens
is implemented for&[char]
and&[u8]
but not for other custom token types that meet the right trait bounds. AFAICTContainsToken<C>
is implemented only withC: AsChar
.Discussed at https://github.com/KittyCAD/modeling-app/pull/731#discussion_r1356957357