As far as I am aware this can't be expressed to the Rust compiler as the cookies argument to the HTTP handler is of type &mut CookieJar and the closure returns an async block that holds that reference.
If someone is galaxy brain and can fix this without requiring a heap allocation or reference counting (Box, Arc, Rc) I will be very thankful.
If this can be fixed we will remove the context system and rely on the closure capturing any state that the user wants in the handler.
As far as I am aware this can't be expressed to the Rust compiler as the cookies argument to the HTTP handler is of type
&mut CookieJar
and the closure returns an async block that holds that reference.If someone is galaxy brain and can fix this without requiring a heap allocation or reference counting (
Box
,Arc
,Rc
) I will be very thankful.If this can be fixed we will remove the context system and rely on the closure capturing any state that the user wants in the handler.