pub struct HttpConnection<State> { /* private fields */ }Expand description
A one-shot HTTP connection whose typestate controls its lifecycle.
Implementations§
Source§impl HttpConnection<AwaitingRequest>
impl HttpConnection<AwaitingRequest>
Sourcepub async fn read_request(
self,
) -> Result<(HttpRequest, HttpConnection<AwaitingResponse>)>
pub async fn read_request( self, ) -> Result<(HttpRequest, HttpConnection<AwaitingResponse>)>
Read one bounded request and transition to AwaitingResponse.
The connection is consumed so a failed or timed-out read cannot be retried at an ambiguous wire position.
§Errors
Returns malformed, oversized, transfer-encoded, truncated, timed-out, or transport failures.
Source§impl HttpConnection<AwaitingResponse>
impl HttpConnection<AwaitingResponse>
Sourcepub async fn write_response(self, response: HttpResponse) -> Result<()>
pub async fn write_response(self, response: HttpResponse) -> Result<()>
Write one bounded response, flush it, and close the connection.
The connection is consumed so a partial write or deadline cannot be
retried. A HEAD request keeps the declared Content-Length but omits
the response body on the wire.
§Errors
Returns invalid response, oversized response, timed-out, or transport failures.
Auto Trait Implementations§
impl<State> Freeze for HttpConnection<State>where
State: Freeze,
impl<State> RefUnwindSafe for HttpConnection<State>where
State: RefUnwindSafe,
impl<State> Send for HttpConnection<State>where
State: Send,
impl<State> Sync for HttpConnection<State>where
State: Sync,
impl<State> Unpin for HttpConnection<State>where
State: Unpin,
impl<State> UnsafeUnpin for HttpConnection<State>where
State: UnsafeUnpin,
impl<State> UnwindSafe for HttpConnection<State>where
State: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more