prost
doesn't have an option to turn that on so you have to do it yourself.
If you want to implement a trait for a type. You need to have either the trait or the type in your library/binary.
Since the trait is in std
and the type is in an external crate the best you can do is create a unit struct to wrap the type. Then implement Debug
for that.
use std::fmt;
struct DebugStruct(NonDebugEnum);
impl fmt::Debug for DebugStruct {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
todo!()
}
}
fn main() {
let wrapped = DebugStruct(NonDebugEnum::Example);
println!("{:?}", wrapped);
}
You will have to come up with the actual logic of how to format it.