diff --git a/exercises/react/example.rs b/exercises/react/example.rs index 927190006..78be8eeb9 100644 --- a/exercises/react/example.rs +++ b/exercises/react/example.rs @@ -44,9 +44,9 @@ struct ComputeCell<'a, T: Copy> { cell: Cell, dependencies: Vec, - f: Box T + 'a>, + f: Box T>, callbacks_issued: usize, - callbacks: HashMap () + 'a>>, + callbacks: HashMap>, } impl Cell { @@ -60,7 +60,7 @@ impl Cell { } impl<'a, T: Copy> ComputeCell<'a, T> { - fn new T + 'a>(initial: T, dependencies: Vec, f: F) -> Self { + fn new T>(initial: T, dependencies: Vec, f: F) -> Self { ComputeCell { cell: Cell::new(initial), @@ -90,7 +90,7 @@ impl<'a, T: Copy + PartialEq> Reactor<'a, T> { InputCellID(self.inputs.len() - 1) } - pub fn create_compute T + 'a>( + pub fn create_compute T>( &mut self, dependencies: &[CellID], compute_func: F, @@ -161,7 +161,7 @@ impl<'a, T: Copy + PartialEq> Reactor<'a, T> { .is_some() } - pub fn add_callback () + 'a>( + pub fn add_callback( &mut self, id: ComputeCellID, callback: F, diff --git a/exercises/react/src/lib.rs b/exercises/react/src/lib.rs index 6b91f9bc2..ad513ff73 100644 --- a/exercises/react/src/lib.rs +++ b/exercises/react/src/lib.rs @@ -105,7 +105,7 @@ impl Reactor { // * Exactly once if the compute cell's value changed as a result of the set_value call. // The value passed to the callback should be the final value of the compute cell after the // set_value call. - pub fn add_callback ()>( + pub fn add_callback( &mut self, _id: ComputeCellID, _callback: F,