#Unconstrained type parameter

14 messages · Page 1 of 1 (latest)

marble bolt
#

Could someone help me understand why C is considered to be unconstrained here, when it is used in the constraint for F?

#
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)
    }
}```
velvet lichen
marble bolt
#

damn, so I can't make Context an associated type I guess

#

that's really annoying

#

Parser<'a, C, T, E> is a keyboardful

velvet lichen
marble bolt
#

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

marble bolt
#

is that a yes or a no

velvet lichen
marble bolt
#

I don't know whether traits can apply to a monomorphization of a generic function