pub trait Codec { type Data; const ID: &'static str; }
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".