Not every trait can become a dyn Trait. A trait is object safe only if every method can be called through a vtable — that is, knowing nothing about the concrete type but its address.
Two rules cause almost every real failure:
- No generic methods.
fn build<T: Encode>(&self, v: T)would need one vtable slot per possibleT, and the set is unbounded. - No
Selfin return position.fn clone_me(&self) -> Selfcannot work: the caller has no idea whatSelfis or how big it is.
