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 Oct 19, 2023
1 parent 7848b5a commit 87bc06b
Show file tree
Hide file tree
Showing 14 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/body/incoming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::task::{Context, Poll};
use bytes::Bytes;
use futures_channel::mpsc;
use futures_channel::oneshot;
use futures_util::ready;
use futures_util::{stream::FusedStream, Stream}; // for mpsc::Receiver
use http::HeaderMap;
use http_body::{Body, Frame, SizeHint};
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
9 changes: 0 additions & 9 deletions src/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
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 @@ -84,9 +84,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};
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 @@ -11,6 +11,7 @@ use std::time::Duration;

use crate::rt::{Read, Write};
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 87bc06b

Please sign in to comment.