From 121075c1effdf210973fedc4ee4fe072ca3f87d5 Mon Sep 17 00:00:00 2001 From: Igor Aleksanov Date: Fri, 11 Sep 2020 11:24:39 +0300 Subject: [PATCH] awc: Rename Client::build to Client::builder (#1665) --- awc/CHANGES.md | 2 ++ awc/src/lib.rs | 5 +++-- awc/src/request.rs | 4 ++-- awc/src/ws.rs | 2 +- awc/tests/test_client.rs | 8 ++++---- awc/tests/test_connector.rs | 2 +- awc/tests/test_rustls_client.rs | 2 +- awc/tests/test_ssl_client.rs | 2 +- src/test.rs | 2 +- test-server/src/lib.rs | 2 +- tests/test_httpserver.rs | 4 ++-- 11 files changed, 19 insertions(+), 16 deletions(-) diff --git a/awc/CHANGES.md b/awc/CHANGES.md index 4a830b8f..38faba45 100644 --- a/awc/CHANGES.md +++ b/awc/CHANGES.md @@ -1,6 +1,8 @@ # Changes ## Unreleased - 2020-xx-xx +### Changed +* `Client::build` was renamed to `Client::builder`. ## 2.0.0-beta.4 - 2020-09-09 diff --git a/awc/src/lib.rs b/awc/src/lib.rs index 4850b78f..45c52092 100644 --- a/awc/src/lib.rs +++ b/awc/src/lib.rs @@ -166,8 +166,9 @@ impl Client { Client::default() } - /// Build client instance. - pub fn build() -> ClientBuilder { + /// Create `Client` builder. + /// This function is equivalent of `ClientBuilder::new()`. + pub fn builder() -> ClientBuilder { ClientBuilder::new() } diff --git a/awc/src/request.rs b/awc/src/request.rs index c34a8e22..dcada2c6 100644 --- a/awc/src/request.rs +++ b/awc/src/request.rs @@ -623,7 +623,7 @@ mod tests { #[actix_rt::test] async fn test_client_header() { - let req = Client::build() + let req = Client::builder() .header(header::CONTENT_TYPE, "111") .finish() .get("/"); @@ -641,7 +641,7 @@ mod tests { #[actix_rt::test] async fn test_client_header_override() { - let req = Client::build() + let req = Client::builder() .header(header::CONTENT_TYPE, "111") .finish() .get("/") diff --git a/awc/src/ws.rs b/awc/src/ws.rs index 96687ac7..57e80bd4 100644 --- a/awc/src/ws.rs +++ b/awc/src/ws.rs @@ -434,7 +434,7 @@ mod tests { #[actix_rt::test] async fn test_header_override() { - let req = Client::build() + let req = Client::builder() .header(header::CONTENT_TYPE, "111") .finish() .ws("/") diff --git a/awc/tests/test_client.rs b/awc/tests/test_client.rs index 21be155e..a9552d0d 100644 --- a/awc/tests/test_client.rs +++ b/awc/tests/test_client.rs @@ -120,7 +120,7 @@ async fn test_timeout() { .timeout(Duration::from_secs(15)) .finish(); - let client = awc::Client::build() + let client = awc::Client::builder() .connector(connector) .timeout(Duration::from_millis(50)) .finish(); @@ -141,7 +141,7 @@ async fn test_timeout_override() { }))) }); - let client = awc::Client::build() + let client = awc::Client::builder() .timeout(Duration::from_millis(50000)) .finish(); let request = client @@ -291,7 +291,7 @@ async fn test_connection_wait_queue() { }) .await; - let client = awc::Client::build() + let client = awc::Client::builder() .connector(awc::Connector::new().limit(1).finish()) .finish(); @@ -340,7 +340,7 @@ async fn test_connection_wait_queue_force_close() { }) .await; - let client = awc::Client::build() + let client = awc::Client::builder() .connector(awc::Connector::new().limit(1).finish()) .finish(); diff --git a/awc/tests/test_connector.rs b/awc/tests/test_connector.rs index 633ac2d5..888f7a90 100644 --- a/awc/tests/test_connector.rs +++ b/awc/tests/test_connector.rs @@ -47,7 +47,7 @@ async fn test_connection_window_size() { .set_alpn_protos(b"\x02h2\x08http/1.1") .map_err(|e| log::error!("Can not set alpn protocol: {:?}", e)); - let client = awc::Client::build() + let client = awc::Client::builder() .connector(awc::Connector::new().ssl(builder.build()).finish()) .initial_window_size(100) .initial_connection_window_size(100) diff --git a/awc/tests/test_rustls_client.rs b/awc/tests/test_rustls_client.rs index 8fb43c43..0df6b154 100644 --- a/awc/tests/test_rustls_client.rs +++ b/awc/tests/test_rustls_client.rs @@ -82,7 +82,7 @@ async fn _test_connection_reuse_h2() { .dangerous() .set_certificate_verifier(Arc::new(danger::NoCertificateVerification {})); - let client = awc::Client::build() + let client = awc::Client::builder() .connector(awc::Connector::new().rustls(Arc::new(config)).finish()) .finish(); diff --git a/awc/tests/test_ssl_client.rs b/awc/tests/test_ssl_client.rs index ca65fb24..eced5f14 100644 --- a/awc/tests/test_ssl_client.rs +++ b/awc/tests/test_ssl_client.rs @@ -62,7 +62,7 @@ async fn test_connection_reuse_h2() { .set_alpn_protos(b"\x02h2\x08http/1.1") .map_err(|e| log::error!("Can not set alpn protocol: {:?}", e)); - let client = awc::Client::build() + let client = awc::Client::builder() .connector(awc::Connector::new().ssl(builder.build()).finish()) .finish(); diff --git a/src/test.rs b/src/test.rs index 49c5cc21..3cc6ae45 100644 --- a/src/test.rs +++ b/src/test.rs @@ -822,7 +822,7 @@ where } }; - Client::build().connector(connector).finish() + Client::builder().connector(connector).finish() }; TestServer { diff --git a/test-server/src/lib.rs b/test-server/src/lib.rs index f6c1183b..5d575027 100644 --- a/test-server/src/lib.rs +++ b/test-server/src/lib.rs @@ -90,7 +90,7 @@ pub async fn test_server>(factory: F) -> TestServer } }; - Client::build().connector(connector).finish() + Client::builder().connector(connector).finish() }; actix_connect::start_default_resolver().await.unwrap(); diff --git a/tests/test_httpserver.rs b/tests/test_httpserver.rs index 50c0a764..118640ac 100644 --- a/tests/test_httpserver.rs +++ b/tests/test_httpserver.rs @@ -43,7 +43,7 @@ async fn test_start() { { use actix_http::client; - let client = awc::Client::build() + let client = awc::Client::builder() .connector( client::Connector::new() .timeout(Duration::from_millis(100)) @@ -115,7 +115,7 @@ async fn test_start_ssl() { .set_alpn_protos(b"\x02h2\x08http/1.1") .map_err(|e| log::error!("Can not set alpn protocol: {:?}", e)); - let client = awc::Client::build() + let client = awc::Client::builder() .connector( awc::Connector::new() .ssl(builder.build())