diff --git a/ofborg/src/easyamqp.rs b/ofborg/src/easyamqp.rs index 3104e24..a253fa3 100644 --- a/ofborg/src/easyamqp.rs +++ b/ofborg/src/easyamqp.rs @@ -303,7 +303,7 @@ pub trait ChannelExt { fn bind_queue(&mut self, config: BindQueueConfig) -> Result<(), Self::Error>; } -pub trait ConsumerExt { +pub trait ConsumerExt<'a, C> { type Error; type Handle; fn consume(self, callback: C, config: ConsumeConfig) -> Result; @@ -351,7 +351,7 @@ impl ChannelExt for amqp::Channel { } } -impl ConsumerExt for amqp::Channel { +impl ConsumerExt<'_, C> for amqp::Channel { type Error = amqp::AMQPError; type Handle = Self; diff --git a/ofborg/src/easylapin.rs b/ofborg/src/easylapin.rs index c5c8eb6..1aeee73 100644 --- a/ofborg/src/easylapin.rs +++ b/ofborg/src/easylapin.rs @@ -80,9 +80,9 @@ impl ChannelExt for CloseOnDrop { } } -impl ConsumerExt for CloseOnDrop { +impl<'a, W: SimpleWorker + 'a> ConsumerExt<'a, W> for CloseOnDrop { type Error = lapin::Error; - type Handle = Pin + 'static>>; + type Handle = Pin + 'a>>; fn consume(self, mut worker: W, config: ConsumeConfig) -> Result { task::block_on(self.basic_qos(1, BasicQosOptions::default()))?; @@ -130,9 +130,9 @@ impl<'a> NotificationReceiver for ChannelNotificationReceiver<'a> { // but one could probably be implemented in terms of the other instead. pub struct NotifyChannel(pub CloseOnDrop); -impl ConsumerExt for NotifyChannel { +impl<'a, W: SimpleNotifyWorker + 'a> ConsumerExt<'a, W> for NotifyChannel { type Error = lapin::Error; - type Handle = Pin + 'static>>; + type Handle = Pin + 'a>>; fn consume(self, worker: W, config: ConsumeConfig) -> Result { task::block_on(self.0.basic_qos(1, BasicQosOptions::default()))?;