Skip to content

Commit

Permalink
refactor(common): replace hyper::common::ready with futures_util::ready
Browse files Browse the repository at this point in the history
  • Loading branch information
tottoto committed Jan 7, 2024
1 parent a9fa893 commit c0a2116
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 15 deletions.
5 changes: 5 additions & 0 deletions src/body/incoming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ use std::task::{Context, Poll};
use bytes::Bytes;
#[cfg(all(feature = "http1", any(feature = "client", feature = "server")))]
use futures_channel::{mpsc, oneshot};
#[cfg(all(
any(feature = "http1", feature = "http2"),
any(feature = "client", feature = "server")
))]
use futures_util::ready;
#[cfg(all(feature = "http1", any(feature = "client", feature = "server")))]
use futures_util::{stream::FusedStream, Stream}; // for mpsc::Receiver
#[cfg(all(feature = "http1", any(feature = "client", feature = "server")))]
Expand Down
1 change: 1 addition & 0 deletions src/client/conn/http1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::task::{Context, Poll};

use crate::rt::{Read, Write};
use bytes::Bytes;
use futures_util::ready;
use http::{Request, Response};
use httparse::ParserConfig;

Expand Down
1 change: 1 addition & 0 deletions src/client/conn/http2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use std::task::{Context, Poll};
use std::time::Duration;

use crate::rt::{Read, Write};
use futures_util::ready;
use http::{Request, Response};

use super::super::dispatch;
Expand Down
13 changes: 0 additions & 13 deletions src/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
#[cfg(all(
any(feature = "client", feature = "server"),
any(feature = "http1", feature = "http2")
))]
macro_rules! ready {
($e:expr) => {
match $e {
std::task::Poll::Ready(v) => v,
std::task::Poll::Pending => return std::task::Poll::Pending,
}
};
}

#[cfg(all(any(feature = "client", feature = "server"), feature = "http1"))]
pub(crate) mod buf;
#[cfg(all(feature = "server", any(feature = "http1", feature = "http2")))]
Expand Down
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,8 @@ mod cfg;
#[macro_use]
mod trace;

#[macro_use]
mod common;
pub mod body;
mod common;
mod error;
pub mod ext;
#[cfg(test)]
Expand Down
1 change: 1 addition & 0 deletions src/proto/h1/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::time::Duration;

use crate::rt::{Read, Write};
use bytes::{Buf, Bytes};
use futures_util::ready;
use http::header::{HeaderValue, CONNECTION, TE};
use http::{HeaderMap, Method, Version};
use httparse::ParserConfig;
Expand Down
1 change: 1 addition & 0 deletions src/proto/h1/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::task::{Context, Poll};
use std::usize;

use bytes::Bytes;
use futures_util::ready;

use super::io::MemRead;
use super::DecodedLength;
Expand Down
1 change: 1 addition & 0 deletions src/proto/h1/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::{

use crate::rt::{Read, Write};
use bytes::{Buf, Bytes};
use futures_util::ready;
use http::Request;

use super::{Http1Transaction, Wants};
Expand Down
1 change: 1 addition & 0 deletions src/proto/h1/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use std::task::{Context, Poll};

use crate::rt::{Read, ReadBuf, Write};
use bytes::{Buf, BufMut, Bytes, BytesMut};
use futures_util::ready;

use super::{Http1Transaction, ParseContext, ParsedMessage};
use crate::common::buf::BufList;
Expand Down
1 change: 1 addition & 0 deletions src/proto/h2/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use bytes::Bytes;
use futures_channel::mpsc::{Receiver, Sender};
use futures_channel::{mpsc, oneshot};
use futures_util::future::{Either, FusedFuture, FutureExt as _};
use futures_util::ready;
use futures_util::stream::{StreamExt as _, StreamFuture};
use h2::client::{Builder, Connection, SendRequest};
use h2::SendStream;
Expand Down
1 change: 1 addition & 0 deletions src/proto/h2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::pin::Pin;
use std::task::{Context, Poll};

use bytes::{Buf, Bytes};
use futures_util::ready;
use h2::{Reason, RecvStream, SendStream};
use http::header::{HeaderName, CONNECTION, TE, TRAILER, TRANSFER_ENCODING, UPGRADE};
use http::HeaderMap;
Expand Down
1 change: 1 addition & 0 deletions src/proto/h2/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::task::{Context, Poll};
use std::time::Duration;

use bytes::Bytes;
use futures_util::ready;
use h2::server::{Connection, Handshake, SendResponse};
use h2::{Reason, RecvStream};
use http::{Method, Request};
Expand Down
1 change: 1 addition & 0 deletions src/server/conn/http1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use std::time::Duration;
use crate::rt::{Read, Write};
use crate::upgrade::Upgraded;
use bytes::Bytes;
use futures_util::ready;

use crate::body::{Body, Incoming as IncomingBody};
use crate::proto;
Expand Down
1 change: 1 addition & 0 deletions src/server/conn/http2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use std::task::{Context, Poll};
use std::time::Duration;

use crate::rt::{Read, Write};
use futures_util::ready;
use pin_project_lite::pin_project;

use crate::body::{Body, Incoming as IncomingBody};
Expand Down

0 comments on commit c0a2116

Please sign in to comment.