tokio_amqp/
lib.rs

1use lapin::ConnectionProperties;
2
3#[deprecated(note = "use tokio-executor-trait and tokio-reactor-trait directly instead")]
4pub trait LapinTokioExt {
5    #[deprecated(note = "use tokio-executor-trait and tokio-reactor-trait directly instead")]
6    fn with_tokio(self) -> Self
7    where
8        Self: Sized,
9    {
10        let this = self.with_tokio_executor();
11        #[cfg(unix)]
12        let this = this.with_tokio_reactor();
13        this
14    }
15
16    #[deprecated(note = "use tokio-executor-trait directly instead")]
17    fn with_tokio_executor(self) -> Self
18    where
19        Self: Sized;
20
21    #[cfg(unix)]
22    #[deprecated(note = "use tokio-reactor-trait directly instead")]
23    fn with_tokio_reactor(self) -> Self
24    where
25        Self: Sized;
26}
27
28impl LapinTokioExt for ConnectionProperties {
29    fn with_tokio_executor(self) -> Self {
30        self.with_executor(tokio_executor_trait::Tokio::current())
31    }
32
33    #[cfg(unix)]
34    fn with_tokio_reactor(self) -> Self {
35        self.with_reactor(tokio_reactor_trait::Tokio)
36    }
37}