Hello. I am trying to make a wrapper struct of "async callable" objects because I am making a trait that requires to implement a method that returns async closures and I want that trait to be object-safe.
I will provide the minimal code example I tried in Rust Playground Gist=c5d2e0...
The code of AsyncCallable is inspired by rust-lang/rust#93582.
The reason why I added Fut: ?Sized on AsyncCallableWrapper is because compiler suggested me to relaxing implicit Sized bound of it.
I thought that async closure implements Fn(i32) -> impl Future<Output = i32> therefore it automatically implements AsyncCallable<i32, Future=..., Out=i32, Output=...>. But seems I am wrong, according to the compilation result.
Also there is another compilation error about unknown size of (dyn Future<Output = i32> + 'static), but I thought that's return type of incremented which I think would be covered by AsyncCallableWrapper::sender and I don't know why the returning type in Box being unknown is a problem.
What is a problem of the above code? How can I fix it to achieve my original goal?
Thanks in advance.