Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/ofborg
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3b6947cd20a3
Choose a base ref
...
head repository: NixOS/ofborg
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 45201a2f0ea4
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on May 1, 2020

  1. remove static lifetimes from easylapin

    Unlike amqp::Consumer lapin channels don't need to have a 'static
    lifetime, the workers just need to live at least as long as the channel.
    LnL7 committed May 1, 2020
    Copy the full SHA
    c4ab729 View commit details

Commits on May 3, 2020

  1. Merge pull request #479 from LnL7/lapin-lifetimes

    remove static lifetimes from easylapin
    LnL7 authored May 3, 2020

    Verified

    This commit was signed with the committer’s verified signature.
    vcunat Vladimír Čunát
    Copy the full SHA
    45201a2 View commit details
Showing with 6 additions and 6 deletions.
  1. +2 −2 ofborg/src/easyamqp.rs
  2. +4 −4 ofborg/src/easylapin.rs
4 changes: 2 additions & 2 deletions ofborg/src/easyamqp.rs
Original file line number Diff line number Diff line change
@@ -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;

8 changes: 4 additions & 4 deletions ofborg/src/easylapin.rs
Original file line number Diff line number Diff line change
@@ -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()))?;