I replaced fn(x) -> y
typing with FnMut(x) -> y
according to my needs and according to what was suggested for me here. But I got another error:
trait objects must include the
dyn
keyword
This is minimal sandbox that reproduces the error.
I tried to investigate the issue. So, I found this. After that I tried to add dyn. But since I got error that size in not known at compile time, I also tried to add Box
to typing like:
-> vector<Box<dyn FnMut(HandlerInput) -> Result<HandlerResponse, Error>>>
and after that tried to wrap handlers with Box::new()
, but still have no success. I feel like I do something wrong.
Could somebody explain me how to fix this issue ? Maybe dyn not what I should use ? (I also tried to use impl instead, but this not helped)