diff --git a/Cargo.toml b/Cargo.toml index 22826d9900..150b030a75 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -131,7 +131,6 @@ map_err_ignore = "allow" map_unwrap_or = "allow" match_wild_err_arm = "allow" missing_fields_in_debug = "allow" # TODO: use finish_non_exhaustive -missing_errors_doc = "allow" # TODO: good to fix missing_panics_doc = "allow" # TODO: might be false multiple_inherent_impl = "allow" multiple_unsafe_ops_per_block = "allow" diff --git a/src/client/conn/http1.rs b/src/client/conn/http1.rs index ec64543c23..7468507623 100644 --- a/src/client/conn/http1.rs +++ b/src/client/conn/http1.rs @@ -97,6 +97,10 @@ where /// Prevent shutdown of the underlying IO object at the end of service the request, /// instead run `into_parts`. This is a convenience wrapper over `poll_without_shutdown`. + /// + /// # Errors + /// + /// Returns an error if the connection encounters an error while being polled to completion. pub async fn without_shutdown(self) -> crate::Result> { let mut conn = Some(self); crate::common::future::poll_fn(move |cx| -> Poll>> { @@ -137,6 +141,10 @@ pub struct Builder { /// /// This is a shortcut for `Builder::new().handshake(io)`. /// See [`client::conn`](crate::client::conn) for more. +/// +/// # Errors +/// +/// Returns an error if the HTTP/1 connection handshake fails. pub async fn handshake(io: T) -> crate::Result<(SendRequest, Connection)> where T: Read + Write + Unpin, @@ -159,6 +167,8 @@ impl SendRequest { /// Waits until the dispatcher is ready. /// + /// # Errors + /// /// If the associated connection is closed, this returns an Error. pub async fn ready(&mut self) -> crate::Result<()> { crate::common::future::poll_fn(|cx| self.poll_ready(cx)).await @@ -210,6 +220,11 @@ where /// hyper closes the underlying connection when a request future is /// dropped before completion. Any subsequent calls on the same /// [`SendRequest`] will return a `canceled` error. + /// + /// # Errors + /// + /// Returns an error if the connection is not ready or if an error occurs while + /// processing the request. pub fn send_request( &mut self, req: Request, @@ -236,7 +251,7 @@ where /// /// Returns a future that if successful, yields the `Response`. /// - /// # Error + /// # Errors /// /// If there was an error before trying to serialize the request to the /// connection, the message will be returned as part of this error. @@ -533,6 +548,10 @@ impl Builder { /// /// Note, if [`Connection`] is not `await`-ed, [`SendRequest`] will /// do nothing. + /// + /// # Errors + /// + /// Returns an error if the HTTP/1connection handshake fails. pub fn handshake( &self, io: T, diff --git a/src/client/conn/http2.rs b/src/client/conn/http2.rs index ec046e0a39..d1dfcfd416 100644 --- a/src/client/conn/http2.rs +++ b/src/client/conn/http2.rs @@ -74,6 +74,10 @@ pub struct Builder { /// /// This is a shortcut for `Builder::new(exec).handshake(io)`. /// See [`client::conn`](crate::client::conn) for more. +/// +/// # Errors +/// +/// Returns an error if the HTTP/2 connection handshake fails. pub async fn handshake( exec: E, io: T, @@ -104,6 +108,8 @@ impl SendRequest { /// Waits until the dispatcher is ready. /// + /// # Errors + /// /// If the associated connection is closed, this returns an Error. pub async fn ready(&mut self) -> crate::Result<()> { crate::common::future::poll_fn(|cx| self.poll_ready(cx)).await @@ -147,6 +153,11 @@ where /// other in-flight and future requests. The peer is notified /// immediately rather than continuing to send a response body that /// would be discarded. + /// + /// # Errors + /// + /// Returns an error if the connection is not ready or if an error occurs while + /// processing the request. pub fn send_request( &mut self, req: Request, @@ -174,7 +185,7 @@ where /// /// Returns a future that if successful, yields the `Response`. /// - /// # Error + /// # Errors /// /// If there was an error before trying to serialize the request to the /// connection, the message will be returned as part of this error. @@ -547,6 +558,10 @@ where /// /// Note, if [`Connection`] is not `await`-ed, [`SendRequest`] will /// do nothing. + /// + /// # Errors + /// + /// Returns an error if the HTTP/2 connection handshake fails. pub fn handshake( &self, io: T, diff --git a/src/upgrade.rs b/src/upgrade.rs index df1b9e6847..bb350e78ed 100644 --- a/src/upgrade.rs +++ b/src/upgrade.rs @@ -147,8 +147,10 @@ impl Upgraded { /// Tries to downcast the internal trait object to the type passed. /// - /// On success, returns the downcasted parts. On error, returns the - /// `Upgraded` back. + /// On success, returns the downcasted parts. + /// + /// # Errors + /// On error, returns the `Upgraded` back. pub fn downcast(self) -> Result, Self> { let (io, buf) = self.io.into_inner(); match io.__hyper_downcast() {