Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //#![feature(specialization)]
- extern crate serde; // 1.0.78
- extern crate serde_json; // 1.0.27
- #[macro_use] extern crate serde_derive; // 1.0.78
- // #[derive(Debug, Serialize)]
- struct X {
- foo: String,
- }
- trait AlwaysDebug {
- fn always_debug(&self) -> Option<String>;
- }
- impl<T: std::fmt::Debug> AlwaysDebug for T {
- fn always_debug(&self) -> Option<String> {
- None
- }
- }
- fn main() {
- let x = X{foo: "Foo Bar".to_string()};
- println!("{:?}", x.always_debug());
- // println!("{:?}", x);
- // println!("{:?}", serde_json::to_string(&x).unwrap());
- }
Add Comment
Please, Sign In to add comment