rust trait inheritance code example
Example: rust trait inheritance
trait A {}
trait B: A {}
struct S;
impl B for S {}
// Commenting this line will result in a "trait bound unsatisfied" error
impl A for S {}
fn main() {
let _x: &B = &S;
}
trait A {}
trait B: A {}
struct S;
impl B for S {}
// Commenting this line will result in a "trait bound unsatisfied" error
impl A for S {}
fn main() {
let _x: &B = &S;
}