Skip to content

Commit

Permalink
Support Rust 1.60.0 (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpdrsn authored Mar 21, 2023
1 parent 05da3cc commit 0f4905e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

# Unreleased

- None.
- **fixed:** Support Rust 1.60.0

# 0.1.3 (13. March, 2023)

- Implement `Default` for `HttpBody1ToHttpBody04` ([#4])
- **added:** Implement `Default` for `HttpBody1ToHttpBody04` ([#4])

[#4]: https://github.com/davidpdrsn/tower-hyper-http-body-compat/pull/4

Expand Down
4 changes: 2 additions & 2 deletions src/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ where
cx: &mut Context<'_>,
) -> Poll<Option<Result<Self::Data, Self::Error>>> {
let this = self.project();
match task::ready!(this.body.poll_frame(cx)) {
match ready!(this.body.poll_frame(cx)) {
Some(Ok(frame)) => {
let frame = match frame.into_data() {
Ok(data) => return Poll::Ready(Some(Ok(data))),
Expand Down Expand Up @@ -141,7 +141,7 @@ where
break Poll::Ready(Ok(Some(trailers)));
}

match task::ready!(this.body.poll_frame(cx)) {
match ready!(this.body.poll_frame(cx)) {
Some(Ok(frame)) => match frame.into_trailers() {
Ok(trailers) => break Poll::Ready(Ok(Some(trailers))),
// we might get a trailers frame on next poll
Expand Down
6 changes: 3 additions & 3 deletions src/http_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
future::Future,
marker::PhantomData,
pin::Pin,
task::{self, Context, Poll},
task::{Context, Poll},
};

use http::{Request, Response};
Expand Down Expand Up @@ -163,7 +163,7 @@ where

#[inline]
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let res = task::ready!(self.project().future.poll(cx))?;
let res = ready!(self.project().future.poll(cx))?;
Poll::Ready(Ok(res.map(HttpBody04ToHttpBody1::new)))
}
}
Expand Down Expand Up @@ -258,7 +258,7 @@ where

#[inline]
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let res = task::ready!(self.project().future.poll(cx))?;
let res = ready!(self.project().future.poll(cx))?;
Poll::Ready(Ok(res.map(HttpBody1ToHttpBody04::new)))
}
}
11 changes: 11 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,17 @@ macro_rules! cfg_service {
};
}

macro_rules! ready {
($e:expr) => {
match $e {
std::task::Poll::Ready(t) => t,
std::task::Poll::Pending => {
return std::task::Poll::Pending;
}
}
};
}

cfg_service! {
mod service;
mod http_service;
Expand Down

0 comments on commit 0f4905e

Please sign in to comment.