diff --git a/src/callback.rs b/src/callback.rs index 1f56dec59ea..15b1e8a17a8 100644 --- a/src/callback.rs +++ b/src/callback.rs @@ -46,13 +46,14 @@ impl Callback { impl Callback { /// Changes input type of the callback to another. /// Works like common `map` method but in an opposite direction. - pub fn reform(self, func: F) -> Callback + pub fn reform(&self, func: F) -> Callback where F: Fn(T) -> IN + 'static, { + let this = self.clone(); let func = move |input| { let output = func(input); - self.clone().emit(output); + this.emit(output); }; Callback::from(func) }