1

In the code below you can see my attempt at storing the struct in question in another struct.

trait example_trait_object {}

struct example_struct<T: example_trait_object> {
    a: T,
}

struct this_will_hold_example_struct {
    a: example_struct,
}

But if i try to compile this, I'll receive an error.

error[E0107]: wrong number of type arguments: expected 1, found 0

I don't want to hardcode the generic type, is there any way around this problem?

P.S. I only wish to use dynamic dispatch when there's really no other way around this problem.

vallentin
  • 23,478
  • 6
  • 59
  • 81

0 Answers0