A definition of a method not in the implemented trait was given in a trait implementation.
Erroneous code example:
#![allow(unused)]
fn main() {
trait Foo {
fn a();
}
struct Bar;
impl Foo for Bar {
fn a() {}
fn b() {} // error: method `b` is not a member of trait `Foo`
}
} Please verify you didn't misspell the method name and you used the correct trait. First example:
#![allow(unused)]
fn main() {
trait Foo {
fn a();
fn b();
}
struct Bar;
impl Foo for Bar {
fn a() {}
fn b() {} // ok!
}
} Second example:
#![allow(unused)]
fn main() {
trait Foo {
fn a();
}
struct Bar;
impl Foo for Bar {
fn a() {}
}
impl Bar {
fn b() {}
}
}
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/error_codes/E0407.html