Skip to content

Commit b2cf6b9

Browse files
committed
update amq-protocol
1 parent 4343abd commit b2cf6b9

3 files changed

Lines changed: 33 additions & 20 deletions

File tree

Cargo.lock

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ rustls--aws_lc_rs = ["amq-protocol/rustls--aws_lc_rs"] # default, but do
3939
rustls--ring = ["amq-protocol/rustls--ring"] # more compatible, (e.g., easily builds on Windows)
4040

4141
[build-dependencies.amq-protocol-codegen]
42-
version = "^10.0.0-beta.7"
42+
version = "^10.0.0-rc.1"
4343
optional = true
4444

4545
[build-dependencies.serde_json]
@@ -53,11 +53,11 @@ futures-core = "^0.3"
5353
futures-io = "^0.3"
5454

5555
[dependencies.amq-protocol]
56-
version = "^10.0.0-beta.7"
56+
version = "^10.0.0-rc.1"
5757
default-features = false
5858

5959
[dependencies.async-rs]
60-
version = "^0.7"
60+
version = "^0.8"
6161
default-features = false
6262

6363
[dependencies.backon]

src/io_loop.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ use backon::{ExponentialBuilder, Retryable};
1818
use futures_io::{AsyncRead, AsyncWrite};
1919
use std::{
2020
collections::VecDeque,
21+
future::Future,
2122
io,
2223
pin::Pin,
2324
sync::Arc,
24-
task::{Context, Poll},
25+
task::{self, Context, Poll},
2526
thread::Builder as ThreadBuilder,
2627
time::Duration,
2728
};
@@ -578,9 +579,21 @@ impl<
578579
struct RuntimeSleeper<RK: RuntimeKit + Clone + Send + 'static>(Runtime<RK>);
579580

580581
impl<RK: RuntimeKit + Clone + Send + 'static> backon::Sleeper for RuntimeSleeper<RK> {
581-
type Sleep = Pin<Box<dyn Future<Output = ()> + Send + 'static>>; // FIXME
582+
type Sleep = UnitFuture<<RK as Reactor>::Sleep>;
582583

583584
fn sleep(&self, dur: Duration) -> Self::Sleep {
584-
Box::pin(self.0.sleep(dur))
585+
UnitFuture(Box::pin(self.0.sleep(dur)))
586+
}
587+
}
588+
589+
// FIXME: drop UnitFuture when backon supports non-unit futures
590+
struct UnitFuture<F: Future>(Pin<Box<F>>);
591+
592+
impl<F: Future> Future for UnitFuture<F> {
593+
type Output = ();
594+
595+
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
596+
task::ready!(self.0.as_mut().poll(cx));
597+
Poll::Ready(())
585598
}
586599
}

0 commit comments

Comments
 (0)