mirror of
https://github.com/robertwayne/axum-htmx
synced 2024-11-29 14:44:33 +01:00
Move insert_into_extensions into Notifier trait
This commit is contained in:
parent
cdbd892f85
commit
535b19fff8
1 changed files with 2 additions and 2 deletions
|
@ -24,6 +24,8 @@ pub trait Notifier {
|
||||||
sender.send(()).ok();
|
sender.send(()).ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn insert_into_extensions(extensions: &mut Extensions) -> Receiver<()>;
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! define_notifiers {
|
macro_rules! define_notifiers {
|
||||||
|
@ -36,9 +38,7 @@ macro_rules! define_notifiers {
|
||||||
fn sender(&mut self) -> Option<Sender<()>> {
|
fn sender(&mut self) -> Option<Sender<()>> {
|
||||||
self.0.take().and_then(Arc::into_inner)
|
self.0.take().and_then(Arc::into_inner)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
impl $name {
|
|
||||||
fn insert_into_extensions(extensions: &mut Extensions) -> Receiver<()> {
|
fn insert_into_extensions(extensions: &mut Extensions) -> Receiver<()> {
|
||||||
let (tx, rx) = oneshot::channel();
|
let (tx, rx) = oneshot::channel();
|
||||||
if extensions.insert(Self(Some(Arc::new(tx)))).is_some() {
|
if extensions.insert(Self(Some(Arc::new(tx)))).is_some() {
|
||||||
|
|
Loading…
Reference in a new issue