channel_bridge/asynch/
notification.rs

1use core::convert::Infallible;
2
3use crate::notification::Notification;
4
5use super::{Receiver, Sender};
6
7impl Sender for &Notification {
8    type Error = Infallible;
9
10    type Data = ();
11
12    async fn send(&mut self, _data: Self::Data) -> Result<Self::Data, Self::Error> {
13        Notification::notify(self);
14
15        Ok(())
16    }
17}
18
19impl Receiver for &Notification {
20    type Error = Infallible;
21
22    type Data = ();
23
24    async fn recv(&mut self) -> Result<Self::Data, Self::Error> {
25        Notification::wait(self).await;
26        Ok(())
27    }
28}