Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
21 changes: 20 additions & 1 deletion src/client/conn/http1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Parts<T>> {
let mut conn = Some(self);
crate::common::future::poll_fn(move |cx| -> Poll<crate::Result<Parts<T>>> {
Expand Down Expand Up @@ -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<T, B>(io: T) -> crate::Result<(SendRequest<B>, Connection<T, B>)>
where
T: Read + Write + Unpin,
Expand All @@ -159,6 +167,8 @@ impl<B> SendRequest<B> {

/// 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
Expand Down Expand Up @@ -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<B>,
Expand All @@ -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.
Expand Down Expand Up @@ -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<T, B>(
&self,
io: T,
Expand Down
17 changes: 16 additions & 1 deletion src/client/conn/http2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ pub struct Builder<Ex> {
///
/// 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<E, T, B>(
exec: E,
io: T,
Expand Down Expand Up @@ -104,6 +108,8 @@ impl<B> SendRequest<B> {

/// 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
Expand Down Expand Up @@ -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<B>,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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<T, B>(
&self,
io: T,
Expand Down
6 changes: 4 additions & 2 deletions src/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T: Read + Write + Unpin + 'static>(self) -> Result<Parts<T>, Self> {
let (io, buf) = self.io.into_inner();
match io.__hyper_downcast() {
Expand Down
Loading