diff --git a/src/callback.rs b/src/callback.rs index 15b1e8a17a8..d53810e41e3 100644 --- a/src/callback.rs +++ b/src/callback.rs @@ -41,6 +41,12 @@ impl Callback { pub fn emit(&self, value: IN) { (self.0)(value); } + + /// Creates a no-op callback which can be used when it is not suitable to use an + /// `Option`. + pub fn noop() -> Self { + Self::from(|_| {}) + } } impl Callback {