I'm getting this compiler error, that I don't I understand nor know how to fix:
error[E0277]: the trait bound `&'a mut Runnable + 'a: Runnable` is not satisfied
--> src/main.rs:11:9
|
11 | &mut self.runnables[id]
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Runnable` is not implemented for `&'a mut Runnable + 'a`
|
= note: required for the cast to the object type `Runnable + 'a`
I've simplified my code down to this:
pub trait Runnable {
fn name(&self) -> &str;
}
pub struct RunList<'a> {
runnables: Vec<&'a mut Runnable>,
}
impl<'a> RunList<'a> {
pub fn get(&self, id: usize) -> &'a mut Runnable {
&mut self.runnables[id]
}
}
fn main() {}