Skip to content

Commit 52b27fa

Browse files
committedNov 10, 2023
feat(rt): rename to Http2ClientConnExec and Http2ServerConnExec
BREAKING CHANGE: (From previous RCs) `ExecutorClient` is renamed to `Http2ClientConnExec`, and `Http2ConnExec` is renamed to `Http2ServerConnExec`.
1 parent 8bf26d1 commit 52b27fa

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed
 

‎src/client/conn/http2.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use super::super::dispatch;
1616
use crate::body::{Body, Incoming as IncomingBody};
1717
use crate::common::time::Time;
1818
use crate::proto;
19-
use crate::rt::bounds::ExecutorClient;
19+
use crate::rt::bounds::Http2ClientConnExec;
2020
use crate::rt::Timer;
2121

2222
/// The sender side of an established connection.
@@ -41,7 +41,7 @@ pub struct Connection<T, B, E>
4141
where
4242
T: Read + Write + 'static + Unpin,
4343
B: Body + 'static,
44-
E: ExecutorClient<B, T> + Unpin,
44+
E: Http2ClientConnExec<B, T> + Unpin,
4545
B::Error: Into<Box<dyn Error + Send + Sync>>,
4646
{
4747
inner: (PhantomData<T>, proto::h2::ClientTask<B, E, T>),
@@ -73,7 +73,7 @@ where
7373
B: Body + 'static,
7474
B::Data: Send,
7575
B::Error: Into<Box<dyn Error + Send + Sync>>,
76-
E: ExecutorClient<B, T> + Unpin + Clone,
76+
E: Http2ClientConnExec<B, T> + Unpin + Clone,
7777
{
7878
Builder::new(exec).handshake(io).await
7979
}
@@ -202,7 +202,7 @@ where
202202
B: Body + Unpin + 'static,
203203
B::Data: Send,
204204
B::Error: Into<Box<dyn Error + Send + Sync>>,
205-
E: ExecutorClient<B, T> + Unpin,
205+
E: Http2ClientConnExec<B, T> + Unpin,
206206
{
207207
/// Returns whether the [extended CONNECT protocol][1] is enabled or not.
208208
///
@@ -222,7 +222,7 @@ impl<T, B, E> fmt::Debug for Connection<T, B, E>
222222
where
223223
T: Read + Write + fmt::Debug + 'static + Unpin,
224224
B: Body + 'static,
225-
E: ExecutorClient<B, T> + Unpin,
225+
E: Http2ClientConnExec<B, T> + Unpin,
226226
B::Error: Into<Box<dyn Error + Send + Sync>>,
227227
{
228228
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
@@ -237,7 +237,7 @@ where
237237
B::Data: Send,
238238
E: Unpin,
239239
B::Error: Into<Box<dyn Error + Send + Sync>>,
240-
E: ExecutorClient<B, T> + 'static + Send + Sync + Unpin,
240+
E: Http2ClientConnExec<B, T> + 'static + Send + Sync + Unpin,
241241
{
242242
type Output = crate::Result<()>;
243243

@@ -407,7 +407,7 @@ where
407407
B: Body + 'static,
408408
B::Data: Send,
409409
B::Error: Into<Box<dyn Error + Send + Sync>>,
410-
Ex: ExecutorClient<B, T> + Unpin,
410+
Ex: Http2ClientConnExec<B, T> + Unpin,
411411
{
412412
let opts = self.clone();
413413

‎src/proto/h2/client.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use crate::ext::Protocol;
2828
use crate::headers;
2929
use crate::proto::h2::UpgradedSendStream;
3030
use crate::proto::Dispatched;
31-
use crate::rt::bounds::ExecutorClient;
31+
use crate::rt::bounds::Http2ClientConnExec;
3232
use crate::upgrade::Upgraded;
3333
use crate::{Request, Response};
3434
use h2::client::ResponseFuture;
@@ -118,7 +118,7 @@ where
118118
T: Read + Write + Unpin + 'static,
119119
B: Body + 'static,
120120
B::Data: Send + 'static,
121-
E: ExecutorClient<B, T> + Unpin,
121+
E: Http2ClientConnExec<B, T> + Unpin,
122122
B::Error: Into<Box<dyn std::error::Error + Send + Sync>>,
123123
{
124124
let (h2_tx, mut conn) = new_builder(config)
@@ -405,7 +405,7 @@ where
405405
impl<B, E, T> ClientTask<B, E, T>
406406
where
407407
B: Body + 'static,
408-
E: ExecutorClient<B, T> + Unpin,
408+
E: Http2ClientConnExec<B, T> + Unpin,
409409
B::Error: Into<Box<dyn std::error::Error + Send + Sync>>,
410410
T: Read + Write + Unpin,
411411
{
@@ -457,7 +457,7 @@ impl<B, E, T> ClientTask<B, E, T>
457457
where
458458
B: Body + 'static + Unpin,
459459
B::Data: Send,
460-
E: ExecutorClient<B, T> + Unpin,
460+
E: Http2ClientConnExec<B, T> + Unpin,
461461
B::Error: Into<Box<dyn std::error::Error + Send + Sync>>,
462462
T: Read + Write + Unpin,
463463
{
@@ -593,7 +593,7 @@ where
593593
B: Body + 'static + Unpin,
594594
B::Data: Send,
595595
B::Error: Into<Box<dyn std::error::Error + Send + Sync>>,
596-
E: ExecutorClient<B, T> + 'static + Send + Sync + Unpin,
596+
E: Http2ClientConnExec<B, T> + 'static + Send + Sync + Unpin,
597597
T: Read + Write + Unpin,
598598
{
599599
type Output = crate::Result<Dispatched>;

‎src/proto/h2/server.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::headers;
2121
use crate::proto::h2::ping::Recorder;
2222
use crate::proto::h2::{H2Upgraded, UpgradedSendStream};
2323
use crate::proto::Dispatched;
24-
use crate::rt::bounds::Http2ConnExec;
24+
use crate::rt::bounds::Http2ServerConnExec;
2525
use crate::rt::{Read, Write};
2626
use crate::service::HttpService;
2727

@@ -112,7 +112,7 @@ where
112112
S: HttpService<IncomingBody, ResBody = B>,
113113
S::Error: Into<Box<dyn StdError + Send + Sync>>,
114114
B: Body + 'static,
115-
E: Http2ConnExec<S::Future, B>,
115+
E: Http2ServerConnExec<S::Future, B>,
116116
{
117117
pub(crate) fn new(
118118
io: T,
@@ -188,7 +188,7 @@ where
188188
S: HttpService<IncomingBody, ResBody = B>,
189189
S::Error: Into<Box<dyn StdError + Send + Sync>>,
190190
B: Body + 'static,
191-
E: Http2ConnExec<S::Future, B>,
191+
E: Http2ServerConnExec<S::Future, B>,
192192
{
193193
type Output = crate::Result<Dispatched>;
194194

@@ -242,7 +242,7 @@ where
242242
where
243243
S: HttpService<IncomingBody, ResBody = B>,
244244
S::Error: Into<Box<dyn StdError + Send + Sync>>,
245-
E: Http2ConnExec<S::Future, B>,
245+
E: Http2ServerConnExec<S::Future, B>,
246246
{
247247
if self.closing.is_none() {
248248
loop {

‎src/rt/bounds.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
//! implemented by implementing another trait.
55
66
#[cfg(all(feature = "server", feature = "http2"))]
7-
pub use self::h2::Http2ConnExec;
7+
pub use self::h2::Http2ServerConnExec;
88

99
#[cfg(all(feature = "client", feature = "http2"))]
10-
pub use self::h2_client::ExecutorClient;
10+
pub use self::h2_client::Http2ClientConnExec;
1111

1212
#[cfg(all(feature = "client", feature = "http2"))]
13-
#[cfg_attr(docsrs, doc(cfg(all(feature = "server", feature = "http2"))))]
13+
#[cfg_attr(docsrs, doc(cfg(all(feature = "client", feature = "http2"))))]
1414
mod h2_client {
1515
use std::{error::Error, future::Future};
1616

@@ -25,7 +25,7 @@ mod h2_client {
2525
/// This trait is sealed and cannot be implemented for types outside this crate.
2626
///
2727
/// [`Executor`]: crate::rt::Executor
28-
pub trait ExecutorClient<B, T>: sealed_client::Sealed<(B, T)>
28+
pub trait Http2ClientConnExec<B, T>: sealed_client::Sealed<(B, T)>
2929
where
3030
B: http_body::Body,
3131
B::Error: Into<Box<dyn Error + Send + Sync>>,
@@ -35,7 +35,7 @@ mod h2_client {
3535
fn execute_h2_future(&mut self, future: H2ClientFuture<B, T>);
3636
}
3737

38-
impl<E, B, T> ExecutorClient<B, T> for E
38+
impl<E, B, T> Http2ClientConnExec<B, T> for E
3939
where
4040
E: Executor<H2ClientFuture<B, T>>,
4141
B: http_body::Body + 'static,
@@ -78,13 +78,13 @@ mod h2 {
7878
/// This trait is sealed and cannot be implemented for types outside this crate.
7979
///
8080
/// [`Executor`]: crate::rt::Executor
81-
pub trait Http2ConnExec<F, B: Body>: sealed::Sealed<(F, B)> + Clone {
81+
pub trait Http2ServerConnExec<F, B: Body>: sealed::Sealed<(F, B)> + Clone {
8282
#[doc(hidden)]
8383
fn execute_h2stream(&mut self, fut: H2Stream<F, B>);
8484
}
8585

8686
#[doc(hidden)]
87-
impl<E, F, B> Http2ConnExec<F, B> for E
87+
impl<E, F, B> Http2ServerConnExec<F, B> for E
8888
where
8989
E: Executor<H2Stream<F, B>> + Clone,
9090
H2Stream<F, B>: Future<Output = ()>,

‎src/server/conn/http2.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use pin_project_lite::pin_project;
1414

1515
use crate::body::{Body, Incoming as IncomingBody};
1616
use crate::proto;
17-
use crate::rt::bounds::Http2ConnExec;
17+
use crate::rt::bounds::Http2ServerConnExec;
1818
use crate::service::HttpService;
1919
use crate::{common::time::Time, rt::Timer};
2020

@@ -63,7 +63,7 @@ where
6363
I: Read + Write + Unpin,
6464
B: Body + 'static,
6565
B::Error: Into<Box<dyn StdError + Send + Sync>>,
66-
E: Http2ConnExec<S::Future, B>,
66+
E: Http2ServerConnExec<S::Future, B>,
6767
{
6868
/// Start a graceful shutdown process for this connection.
6969
///
@@ -87,7 +87,7 @@ where
8787
I: Read + Write + Unpin + 'static,
8888
B: Body + 'static,
8989
B::Error: Into<Box<dyn StdError + Send + Sync>>,
90-
E: Http2ConnExec<S::Future, B>,
90+
E: Http2ServerConnExec<S::Future, B>,
9191
{
9292
type Output = crate::Result<()>;
9393

@@ -109,9 +109,9 @@ impl<E> Builder<E> {
109109
/// Create a new connection builder.
110110
///
111111
/// This starts with the default options, and an executor which is a type
112-
/// that implements [`Http2ConnExec`] trait.
112+
/// that implements [`Http2ServerConnExec`] trait.
113113
///
114-
/// [`Http2ConnExec`]: crate::rt::bounds::Http2ConnExec
114+
/// [`Http2ServerConnExec`]: crate::rt::bounds::Http2ServerConnExec
115115
pub fn new(exec: E) -> Self {
116116
Self {
117117
exec: exec,
@@ -262,7 +262,7 @@ impl<E> Builder<E> {
262262
Bd: Body + 'static,
263263
Bd::Error: Into<Box<dyn StdError + Send + Sync>>,
264264
I: Read + Write + Unpin,
265-
E: Http2ConnExec<S::Future, Bd>,
265+
E: Http2ServerConnExec<S::Future, Bd>,
266266
{
267267
let proto = proto::h2::Server::new(
268268
io,

0 commit comments

Comments
 (0)
Please sign in to comment.