10 impl fmt::Debug for Thingy {
11 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
12 write!(f, "{{ x: {:?}, y: {:?} }}", self.x, self.y)
16 struct PolymorphicThingy<T> {
20 impl<T:fmt::Debug> fmt::Debug for PolymorphicThingy<T> {
21 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
22 write!(f, "{:?}", self.x)
27 println!("{:?}", Thingy { x: 1, y: 2 });
28 println!("{:?}", PolymorphicThingy { x: Thingy { x: 1, y: 2 } });