Is there a way to get around this problem without rewriting the trait ?
struct Foo<'a>(Option<&'a str>);
trait Bar {
fn bar(&mut self, value: &str);
}
impl<'a> Bar for Foo<'a> {
fn bar(&'a mut self, value: &'a str) {
self.0 = Some(value);
}
}
error[E0308]: method not compatible with trait
--> src/lib.rs:10:5
|
10 | fn bar(&'a mut self, value: &'a str) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= note: expected signature `fn(&mut Foo<'_>, &_)`
found signature `fn(&'a mut Foo<'_>, &'a _)`