From 535b19fff841cb22d9729696d1c095d4ecd24246 Mon Sep 17 00:00:00 2001 From: imbolc Date: Sat, 15 Jun 2024 13:40:22 +0600 Subject: [PATCH] Move insert_into_extensions into Notifier trait --- src/vary_middleware.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vary_middleware.rs b/src/vary_middleware.rs index 0904c16..2146643 100644 --- a/src/vary_middleware.rs +++ b/src/vary_middleware.rs @@ -24,6 +24,8 @@ pub trait Notifier { sender.send(()).ok(); } } + + fn insert_into_extensions(extensions: &mut Extensions) -> Receiver<()>; } macro_rules! define_notifiers { @@ -36,9 +38,7 @@ macro_rules! define_notifiers { fn sender(&mut self) -> Option> { self.0.take().and_then(Arc::into_inner) } - } - impl $name { fn insert_into_extensions(extensions: &mut Extensions) -> Receiver<()> { let (tx, rx) = oneshot::channel(); if extensions.insert(Self(Some(Arc::new(tx)))).is_some() {