Objects with Generic Types over channels

Is there a proper way to send something like Foo<T> over a channel? Or is that just not allowed?

Can you give us an example of what you're trying to do?

If it's more convenient, you can write your code on the playpen and then click the Share button to get a shareable link.

Either make an enum with all possible cases or send a Box<dyn SomeTrait>.

Here's a basic example, as you can see in this example (and most of the time) the compiler is able to infer the type.

Box worked I think. Thanks.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.