Merge pull request #479 from LnL7/lapin-lifetimes
remove static lifetimes from easylapin
This commit is contained in:
commit
45201a2f0e
|
@ -303,7 +303,7 @@ pub trait ChannelExt {
|
||||||
fn bind_queue(&mut self, config: BindQueueConfig) -> Result<(), Self::Error>;
|
fn bind_queue(&mut self, config: BindQueueConfig) -> Result<(), Self::Error>;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ConsumerExt<C> {
|
pub trait ConsumerExt<'a, C> {
|
||||||
type Error;
|
type Error;
|
||||||
type Handle;
|
type Handle;
|
||||||
fn consume(self, callback: C, config: ConsumeConfig) -> Result<Self::Handle, Self::Error>;
|
fn consume(self, callback: C, config: ConsumeConfig) -> Result<Self::Handle, Self::Error>;
|
||||||
|
@ -351,7 +351,7 @@ impl ChannelExt for amqp::Channel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<C: amqp::Consumer + 'static> ConsumerExt<C> for amqp::Channel {
|
impl<C: amqp::Consumer + 'static> ConsumerExt<'_, C> for amqp::Channel {
|
||||||
type Error = amqp::AMQPError;
|
type Error = amqp::AMQPError;
|
||||||
type Handle = Self;
|
type Handle = Self;
|
||||||
|
|
||||||
|
|
|
@ -80,9 +80,9 @@ impl ChannelExt for CloseOnDrop<Channel> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<W: SimpleWorker + 'static> ConsumerExt<W> for CloseOnDrop<Channel> {
|
impl<'a, W: SimpleWorker + 'a> ConsumerExt<'a, W> for CloseOnDrop<Channel> {
|
||||||
type Error = lapin::Error;
|
type Error = lapin::Error;
|
||||||
type Handle = Pin<Box<dyn Future<Output = ()> + 'static>>;
|
type Handle = Pin<Box<dyn Future<Output = ()> + 'a>>;
|
||||||
|
|
||||||
fn consume(self, mut worker: W, config: ConsumeConfig) -> Result<Self::Handle, Self::Error> {
|
fn consume(self, mut worker: W, config: ConsumeConfig) -> Result<Self::Handle, Self::Error> {
|
||||||
task::block_on(self.basic_qos(1, BasicQosOptions::default()))?;
|
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.
|
// but one could probably be implemented in terms of the other instead.
|
||||||
pub struct NotifyChannel(pub CloseOnDrop<Channel>);
|
pub struct NotifyChannel(pub CloseOnDrop<Channel>);
|
||||||
|
|
||||||
impl<W: SimpleNotifyWorker + 'static> ConsumerExt<W> for NotifyChannel {
|
impl<'a, W: SimpleNotifyWorker + 'a> ConsumerExt<'a, W> for NotifyChannel {
|
||||||
type Error = lapin::Error;
|
type Error = lapin::Error;
|
||||||
type Handle = Pin<Box<dyn Future<Output = ()> + 'static>>;
|
type Handle = Pin<Box<dyn Future<Output = ()> + 'a>>;
|
||||||
|
|
||||||
fn consume(self, worker: W, config: ConsumeConfig) -> Result<Self::Handle, Self::Error> {
|
fn consume(self, worker: W, config: ConsumeConfig) -> Result<Self::Handle, Self::Error> {
|
||||||
task::block_on(self.0.basic_qos(1, BasicQosOptions::default()))?;
|
task::block_on(self.0.basic_qos(1, BasicQosOptions::default()))?;
|
||||||
|
|
Loading…
Reference in a new issue