Closed dakom closed 2 years ago
Use case is I have something like this:
async fn foo<A: Serialize, B: DeserializeOwned>(args:A) -> B { ... }
and I want to store it as a callback to be called later, i.e. something that looks like:
struct Callbacks { pub foo: Box<dyn Fn(Box<dyn erased_serde::Serialize>) -> Pin<Box<dyn Future<Output=Box<dyn erased_serde::DeserializeOwned>>>>> }
However, erased_serde doesn't have DeserializeOwned.
Is it possible to add this?
I also brought this up in the Rust forum, in case the surrounding context is helpful in some way: https://users.rust-lang.org/t/how-to-store-callbacks-with-generics/78063/12?u=dakom
Looks like this got addressed in depth in the forum thread.
There's a lot to read through in the forum, is the sumarry that it's not possible?
Use case is I have something like this:
and I want to store it as a callback to be called later, i.e. something that looks like:
However, erased_serde doesn't have DeserializeOwned.
Is it possible to add this?
I also brought this up in the Rust forum, in case the surrounding context is helpful in some way: https://users.rust-lang.org/t/how-to-store-callbacks-with-generics/78063/12?u=dakom