pub trait ToJson { // Required method fn to_json(&self, buf: &mut String); }
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".