Why not make StateT be able to become a dyn Trait?
pub struct AppWrap<Oid, StateT: ?Sized>
where
Oid: Eq + std::hash::Hash + Clone,
{
pub(crate) state: RefCell<Rc<StateT>>, // You sure you have your Rc/RefCell in the right order?
}
@alice This fixed it. Can you point me to dyn docs? (From Rust compiler errors, I have been adding dyn here and there, but apparently it's important to remove it here.)
I guess there is some documentation here. The reason you don't need dyn at that location is that StateT is a generic parameter, not a trait. It's just that traits are also types, and can also be put in generic locations as long as you allowed types that are not sized. There's no guarantee that the user will put a trait as the generic option — they could also put String or even non-sized concrete types such as [u8].