This seems like something relatively simple compared to type_alias_impl_trait and does not require a typedef. e.g.
const DIGIT: impl Fn(&ParserState) -> Result<u8> = <my parser combinator here>;
This seems like something relatively simple compared to type_alias_impl_trait and does not require a typedef. e.g.
const DIGIT: impl Fn(&ParserState) -> Result<u8> = <my parser combinator here>;
Note that this already works and is optimized as expected:
const DIGIT: &dyn Fn(&ParserState) -> Result<u8> = &<my parser combinator here>;
This looks longer than just writing a function though. The point of type_alias_impl_trait is that you can give a name to the closure and store it in a type without using generics.
This tracking issue already exists (but the current implementation is for let only).