Upcasting a trait behind a smart pointer (Rc, etc)

Does fat pointer break it. (not completely sure.)
assert_ne!(::std::mem::size_of::<*const Trait>() , ::std::mem::size_of::<*const Foo>());

Rc:downcast only works from Rc<Any + 'static> so no use from Trait.

If you add to each structure a field;
self_rc: Weak< _ <Self>>; // _ RefCell if you want
Make all constructor calls return an Rc. Have no code to take ownership out of Rc.
You can then add any launch pad to the trait.

2 Likes