pub enum Magic<T> {
Simple(Rc<Store<T>>),
Complex [ exists some type U] (Fn(T) -> U, Rc<Store<U>>),
}
One hope why this is possible is that Rc<Store<U>> has size independent of U, and thus perhaps Foo<T, U> has size independent of U and we can just stuff it all into one struct.
EDIT:
Imagine we have a bunch of Foo<T, U1>, Foo<T, U2>, Foo<T, U3> and we want instead to stuff them all into a Vec<Magic<T>>
What do you need to be able to do with the values in Complex? You could define a trait that maps a T to an internal type and stores it, and then store a trait object of that trait in Complex. You won't be able to ever access a value of type U that way except by manual down casting though.