Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix small typos in Client docs #1253

Merged
merged 1 commit into from
Apr 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 16 additions & 16 deletions src/async_impl/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ use crate::{IntoUrl, Method, Proxy, StatusCode, Url};
/// The `Client` holds a connection pool internally, so it is advised that
/// you create one and **reuse** it.
///
/// You do **not** have to wrap the `Client` it in an [`Rc`] or [`Arc`] to **reuse** it,
/// You do **not** have to wrap the `Client` in an [`Rc`] or [`Arc`] to **reuse** it,
/// because it already uses an [`Arc`] internally.
///
/// [`Rc`]: std::rc::Rc
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also not sure if we need this anymore since [Rc] will automatically link to the docs on newer Rust versions. I see we didn't have an explicit link for [Arc] so I wasn't totally sure what to do here.

Expand All @@ -62,7 +62,7 @@ pub struct Client {
inner: Arc<ClientRef>,
}

/// A `ClientBuilder` can be used to create a `Client` with custom configuration.
/// A `ClientBuilder` can be used to create a `Client` with custom configuration.
#[must_use]
pub struct ClientBuilder {
config: Config,
Expand Down Expand Up @@ -172,7 +172,7 @@ impl ClientBuilder {
///
/// # Errors
///
/// This method fails if TLS backend cannot be initialized, or the resolver
/// This method fails if a TLS backend cannot be initialized, or the resolver
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also be "the" 🤷

/// cannot load the system configuration.
pub fn build(self) -> crate::Result<Client> {
let config = self.config;
Expand Down Expand Up @@ -497,8 +497,8 @@ impl ClientBuilder {
/// - When sending a request and if the request's headers do not already contain
/// an `Accept-Encoding` **and** `Range` values, the `Accept-Encoding` header is set to `gzip`.
/// The request body is **not** automatically compressed.
/// - When receiving a response, if it's headers contain a `Content-Encoding` value that
/// equals to `gzip`, both values `Content-Encoding` and `Content-Length` are removed from the
/// - When receiving a response, if its headers contain a `Content-Encoding` value of
/// `gzip`, both `Content-Encoding` and `Content-Length` are removed from the
/// headers' set. The response body is automatically decompressed.
///
/// If the `gzip` feature is turned on, the default option is enabled.
Expand All @@ -520,8 +520,8 @@ impl ClientBuilder {
/// - When sending a request and if the request's headers do not already contain
/// an `Accept-Encoding` **and** `Range` values, the `Accept-Encoding` header is set to `br`.
/// The request body is **not** automatically compressed.
/// - When receiving a response, if it's headers contain a `Content-Encoding` value that
/// equals to `br`, both values `Content-Encoding` and `Content-Length` are removed from the
/// - When receiving a response, if its headers contain a `Content-Encoding` value of
/// `br`, both `Content-Encoding` and `Content-Length` are removed from the
/// headers' set. The response body is automatically decompressed.
///
/// If the `brotli` feature is turned on, the default option is enabled.
Expand Down Expand Up @@ -1003,7 +1003,7 @@ impl Client {
///
/// # Panics
///
/// This method panics if TLS backend cannot initialized, or the resolver
/// This method panics if a TLS backend cannot initialized, or the resolver
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto - could also be "the" 🤷

/// cannot load the system configuration.
///
/// Use `Client::builder()` if you wish to handle the failure as an `Error`
Expand All @@ -1023,7 +1023,7 @@ impl Client {
///
/// # Errors
///
/// This method fails whenever supplied `Url` cannot be parsed.
/// This method fails whenever the supplied `Url` cannot be parsed.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also kind of want to change Url to url or something because, if someone passes an honest-to-goodness Url, I'm guess it can't not be parsed. The issue is if they pass a non-Url url I assume? But that's pretty pedantic (and also maybe wrong).

pub fn get<U: IntoUrl>(&self, url: U) -> RequestBuilder {
self.request(Method::GET, url)
}
Expand All @@ -1032,7 +1032,7 @@ impl Client {
///
/// # Errors
///
/// This method fails whenever supplied `Url` cannot be parsed.
/// This method fails whenever the supplied `Url` cannot be parsed.
pub fn post<U: IntoUrl>(&self, url: U) -> RequestBuilder {
self.request(Method::POST, url)
}
Expand All @@ -1041,7 +1041,7 @@ impl Client {
///
/// # Errors
///
/// This method fails whenever supplied `Url` cannot be parsed.
/// This method fails whenever the supplied `Url` cannot be parsed.
pub fn put<U: IntoUrl>(&self, url: U) -> RequestBuilder {
self.request(Method::PUT, url)
}
Expand All @@ -1050,7 +1050,7 @@ impl Client {
///
/// # Errors
///
/// This method fails whenever supplied `Url` cannot be parsed.
/// This method fails whenever the supplied `Url` cannot be parsed.
pub fn patch<U: IntoUrl>(&self, url: U) -> RequestBuilder {
self.request(Method::PATCH, url)
}
Expand All @@ -1059,7 +1059,7 @@ impl Client {
///
/// # Errors
///
/// This method fails whenever supplied `Url` cannot be parsed.
/// This method fails whenever the supplied `Url` cannot be parsed.
pub fn delete<U: IntoUrl>(&self, url: U) -> RequestBuilder {
self.request(Method::DELETE, url)
}
Expand All @@ -1068,19 +1068,19 @@ impl Client {
///
/// # Errors
///
/// This method fails whenever supplied `Url` cannot be parsed.
/// This method fails whenever the supplied `Url` cannot be parsed.
pub fn head<U: IntoUrl>(&self, url: U) -> RequestBuilder {
self.request(Method::HEAD, url)
}

/// Start building a `Request` with the `Method` and `Url`.
///
/// Returns a `RequestBuilder`, which will allow setting headers and
/// request body before sending.
/// the request body before sending.
///
/// # Errors
///
/// This method fails whenever supplied `Url` cannot be parsed.
/// This method fails whenever the supplied `Url` cannot be parsed.
pub fn request<U: IntoUrl>(&self, method: Method, url: U) -> RequestBuilder {
let req = url.into_url().map(move |url| Request::new(method, url));
RequestBuilder::new(self.clone(), req)
Expand Down