Skip to content

Commit 669df21

Browse files
Michael-J-Wardseanmonstar
authored andcommitted
feat(client): remove http2_ prefixes from client::conn::http2::Builder methods
Refs: #3085
1 parent 4cbaef7 commit 669df21

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

src/client/conn/http2.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ impl Builder {
278278
/// If not set, hyper will use a default.
279279
///
280280
/// [spec]: https://http2.github.io/http2-spec/#SETTINGS_INITIAL_WINDOW_SIZE
281-
pub fn http2_initial_stream_window_size(&mut self, sz: impl Into<Option<u32>>) -> &mut Self {
281+
pub fn initial_stream_window_size(&mut self, sz: impl Into<Option<u32>>) -> &mut Self {
282282
if let Some(sz) = sz.into() {
283283
self.h2_builder.adaptive_window = false;
284284
self.h2_builder.initial_stream_window_size = sz;
@@ -291,7 +291,7 @@ impl Builder {
291291
/// Passing `None` will do nothing.
292292
///
293293
/// If not set, hyper will use a default.
294-
pub fn http2_initial_connection_window_size(
294+
pub fn initial_connection_window_size(
295295
&mut self,
296296
sz: impl Into<Option<u32>>,
297297
) -> &mut Self {
@@ -305,9 +305,9 @@ impl Builder {
305305
/// Sets whether to use an adaptive flow control.
306306
///
307307
/// Enabling this will override the limits set in
308-
/// `http2_initial_stream_window_size` and
309-
/// `http2_initial_connection_window_size`.
310-
pub fn http2_adaptive_window(&mut self, enabled: bool) -> &mut Self {
308+
/// `initial_stream_window_size` and
309+
/// `initial_connection_window_size`.
310+
pub fn adaptive_window(&mut self, enabled: bool) -> &mut Self {
311311
use proto::h2::SPEC_WINDOW_SIZE;
312312

313313
self.h2_builder.adaptive_window = enabled;
@@ -323,7 +323,7 @@ impl Builder {
323323
/// Passing `None` will do nothing.
324324
///
325325
/// If not set, hyper will use a default.
326-
pub fn http2_max_frame_size(&mut self, sz: impl Into<Option<u32>>) -> &mut Self {
326+
pub fn max_frame_size(&mut self, sz: impl Into<Option<u32>>) -> &mut Self {
327327
if let Some(sz) = sz.into() {
328328
self.h2_builder.max_frame_size = sz;
329329
}
@@ -336,7 +336,7 @@ impl Builder {
336336
/// Pass `None` to disable HTTP2 keep-alive.
337337
///
338338
/// Default is currently disabled.
339-
pub fn http2_keep_alive_interval(
339+
pub fn keep_alive_interval(
340340
&mut self,
341341
interval: impl Into<Option<Duration>>,
342342
) -> &mut Self {
@@ -347,10 +347,10 @@ impl Builder {
347347
/// Sets a timeout for receiving an acknowledgement of the keep-alive ping.
348348
///
349349
/// If the ping is not acknowledged within the timeout, the connection will
350-
/// be closed. Does nothing if `http2_keep_alive_interval` is disabled.
350+
/// be closed. Does nothing if `keep_alive_interval` is disabled.
351351
///
352352
/// Default is 20 seconds.
353-
pub fn http2_keep_alive_timeout(&mut self, timeout: Duration) -> &mut Self {
353+
pub fn keep_alive_timeout(&mut self, timeout: Duration) -> &mut Self {
354354
self.h2_builder.keep_alive_timeout = timeout;
355355
self
356356
}
@@ -359,11 +359,11 @@ impl Builder {
359359
///
360360
/// If disabled, keep-alive pings are only sent while there are open
361361
/// request/responses streams. If enabled, pings are also sent when no
362-
/// streams are active. Does nothing if `http2_keep_alive_interval` is
362+
/// streams are active. Does nothing if `keep_alive_interval` is
363363
/// disabled.
364364
///
365365
/// Default is `false`.
366-
pub fn http2_keep_alive_while_idle(&mut self, enabled: bool) -> &mut Self {
366+
pub fn keep_alive_while_idle(&mut self, enabled: bool) -> &mut Self {
367367
self.h2_builder.keep_alive_while_idle = enabled;
368368
self
369369
}
@@ -376,7 +376,7 @@ impl Builder {
376376
/// The default value is determined by the `h2` crate.
377377
///
378378
/// [`h2::client::Builder::max_concurrent_reset_streams`]: https://docs.rs/h2/client/struct.Builder.html#method.max_concurrent_reset_streams
379-
pub fn http2_max_concurrent_reset_streams(&mut self, max: usize) -> &mut Self {
379+
pub fn max_concurrent_reset_streams(&mut self, max: usize) -> &mut Self {
380380
self.h2_builder.max_concurrent_reset_streams = Some(max);
381381
self
382382
}
@@ -388,7 +388,7 @@ impl Builder {
388388
/// # Panics
389389
///
390390
/// The value must be no larger than `u32::MAX`.
391-
pub fn http2_max_send_buf_size(&mut self, max: usize) -> &mut Self {
391+
pub fn max_send_buf_size(&mut self, max: usize) -> &mut Self {
392392
assert!(max <= std::u32::MAX as usize);
393393
self.h2_builder.max_send_buffer_size = max;
394394
self

tests/client.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1982,10 +1982,10 @@ mod conn {
19821982
let (_client, conn) = conn::http2::Builder::new()
19831983
.executor(TokioExecutor)
19841984
.timer(TokioTimer)
1985-
.http2_keep_alive_interval(Duration::from_secs(1))
1986-
.http2_keep_alive_timeout(Duration::from_secs(1))
1985+
.keep_alive_interval(Duration::from_secs(1))
1986+
.keep_alive_timeout(Duration::from_secs(1))
19871987
// enable while idle since we aren't sending requests
1988-
.http2_keep_alive_while_idle(true)
1988+
.keep_alive_while_idle(true)
19891989
.handshake::<_, hyper::body::Incoming>(io)
19901990
.await
19911991
.expect("http handshake");
@@ -2011,8 +2011,8 @@ mod conn {
20112011
let (mut client, conn) = conn::http2::Builder::new()
20122012
.executor(TokioExecutor)
20132013
.timer(TokioTimer)
2014-
.http2_keep_alive_interval(Duration::from_secs(1))
2015-
.http2_keep_alive_timeout(Duration::from_secs(1))
2014+
.keep_alive_interval(Duration::from_secs(1))
2015+
.keep_alive_timeout(Duration::from_secs(1))
20162016
.handshake::<_, hyper::body::Incoming>(io)
20172017
.await
20182018
.expect("http handshake");
@@ -2043,8 +2043,8 @@ mod conn {
20432043
let (mut client, conn) = conn::http2::Builder::new()
20442044
.executor(TokioExecutor)
20452045
.timer(TokioTimer)
2046-
.http2_keep_alive_interval(Duration::from_secs(1))
2047-
.http2_keep_alive_timeout(Duration::from_secs(1))
2046+
.keep_alive_interval(Duration::from_secs(1))
2047+
.keep_alive_timeout(Duration::from_secs(1))
20482048
.handshake(io)
20492049
.await
20502050
.expect("http handshake");
@@ -2103,8 +2103,8 @@ mod conn {
21032103
let (mut client, conn) = conn::http2::Builder::new()
21042104
.executor(TokioExecutor)
21052105
.timer(TokioTimer)
2106-
.http2_keep_alive_interval(Duration::from_secs(1))
2107-
.http2_keep_alive_timeout(Duration::from_secs(1))
2106+
.keep_alive_interval(Duration::from_secs(1))
2107+
.keep_alive_timeout(Duration::from_secs(1))
21082108
.handshake(io)
21092109
.await
21102110
.expect("http handshake");

0 commit comments

Comments
 (0)