Replies: 4 comments 6 replies
-
Ah OK, if Changing signatures of methods of |
Beta Was this translation helpful? Give feedback.
-
Sorry this is not true, it depends not only on |
Beta Was this translation helpful? Give feedback.
-
Would be up for creating an issue for the use case that is blocked on this solution? |
Beta Was this translation helpful? Give feedback.
-
FYI the upcoming release of Winnow 0.5
I feel like updating
#290 tried to clean this up but I ran into issues and put it on hold so I can continue the current release. |
Beta Was this translation helpful? Give feedback.
-
Currently (as of v0.4.1),
winnow::stream::AsChar
trait convertsself
into primitive copyable typeschar
,bool
, andusize
. So it should be possible to implement this also for any&T
whereT: AsChar
. In such case, blanket impl such asimpl<'a, T> AsChar for &T where T: AsChar { ... }
can be used, but winnow implementsAsChar
for&'a u8
and&'a char
independently.Are there any reasons for this?
If blanket impl is used, then some parsers will be able to drop
<I as Stream>::Token: Copy
trait bound.One example of this is
winnow::bytes::one_of
. It runsany.verify(...)
internally, butParser::verify
requiresG: Fn(&O2) -> bool
(whereO2
is<I as Stream>::Token
), soone_of
requiresFn(&I::Token) -> bool
, which cannot be possible withoutI::Token: Copy
. With blanket impl,&I::Token
(whereI::Token: AsChar
) will also implementAsChar
, so implicit copy will no longer be required.Beta Was this translation helpful? Give feedback.
All reactions