'inheritance' of generic trait implementation
问题 I wanted to try implementing a trait generically and have users of the trait inherit this 'base' implementation automatically as long as they are compatible. This is the test-code I came up with (note that fmt::Show is std::fmt::Show ): trait Outspoken { fn speak(&self) -> String; } impl<T: fmt::Show> Outspoken for T { fn speak(&self) -> String { format!("{:?}", self) } } // In theory, we can now let my-types speak #[derive(Show)] struct MyType(i32); // 'Show' works assert_eq!(format!("{:?}",