diff --git a/zenoh/src/api/handlers/callback.rs b/zenoh/src/api/handlers/callback.rs index 4022fb85da..d08a0ff558 100644 --- a/zenoh/src/api/handlers/callback.rs +++ b/zenoh/src/api/handlers/callback.rs @@ -36,6 +36,17 @@ where } } +impl<'a, T, F, H> IntoHandler<'a, T> for (F, H) +where + F: Fn(T) + Send + Sync + 'a, +{ + type Handler = H; + + fn into_handler(self) -> (Callback<'a, T>, Self::Handler) { + (Dyn::from(self.0), self.1) + } +} + impl IntoHandler<'static, T> for (flume::Sender, flume::Receiver) { type Handler = flume::Receiver;