Merge pull request #479 from LnL7/lapin-lifetimes

remove static lifetimes from easylapin
This commit is contained in:
Daiderd Jordan 2020-05-03 19:10:03 +02:00 committed by GitHub
commit 45201a2f0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View file

@ -303,7 +303,7 @@ pub trait ChannelExt {
fn bind_queue(&mut self, config: BindQueueConfig) -> Result<(), Self::Error>;
}
pub trait ConsumerExt<C> {
pub trait ConsumerExt<'a, C> {
type Error;
type Handle;
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 Handle = Self;

View file

@ -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 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> {
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<Channel>);
impl<W: SimpleNotifyWorker + 'static> ConsumerExt<W> for NotifyChannel {
impl<'a, W: SimpleNotifyWorker + 'a> ConsumerExt<'a, W> for NotifyChannel {
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> {
task::block_on(self.0.basic_qos(1, BasicQosOptions::default()))?;