#Unconstrained type parameter
14 messages · Page 1 of 1 (latest)
impl<
'a,
T: 'a,
E: From<ParserError>,
C,
F: FnMut(&'a mut C, &'a str) -> ParserResult<'a, T, E>,
> Parser<'a, T, E> for F
{
type Context = C;
fn parse(&mut self, ctx: &'a mut C, input: &'a str) -> ParserResult<'a, T, E> {
self(input)
}
}```
Associated types do not count as a constraint for generics. It considers C to be anything which would make this conflicting implementations
damn, so I can't make Context an associated type I guess
that's really annoying
Parser<'a, C, T, E> is a keyboardful
Additionally it's possible for a F to implement FnMut for multiple C
because it could be a generic function?
is a monomorphization of a generic function considered to be a separate "type" which can have traits like this implemented on it
FnMut is a normal* trait
is that a yes or a no
And monomorphizations are separate types
I don't know whether traits can apply to a monomorphization of a generic function