pub struct Request<W> {
pub url: Url,
pub version: HttpVersion,
/* private fields */
}Expand description
A client request to a remote server. The W type tracks the state of the request, Fresh vs Streaming.
Fields§
§url: UrlThe target URI for this request.
version: HttpVersionThe HTTP version of this request.
Implementations§
source§impl Request<Fresh>
impl Request<Fresh>
sourcepub fn with_message(
method: Method,
url: Url,
message: Box<dyn HttpMessage>
) -> Result<Request<Fresh>>
pub fn with_message( method: Method, url: Url, message: Box<dyn HttpMessage> ) -> Result<Request<Fresh>>
Create a new Request<Fresh> that will use the given HttpMessage for its communication
with the server. This implies that the given HttpMessage instance has already been
properly initialized by the caller (e.g. a TCP connection’s already established).
sourcepub fn with_connector<C, S>(
method: Method,
url: Url,
connector: &C
) -> Result<Request<Fresh>>
pub fn with_connector<C, S>( method: Method, url: Url, connector: &C ) -> Result<Request<Fresh>>
Create a new client request with a specific underlying NetworkStream.
sourcepub fn start(self) -> Result<Request<Streaming>>
pub fn start(self) -> Result<Request<Streaming>>
Consume a Fresh Request, writing the headers and method, returning a Streaming Request.
sourcepub fn headers_mut(&mut self) -> &mut Headers
pub fn headers_mut(&mut self) -> &mut Headers
Get a mutable reference to the Request headers.
Trait Implementations§
source§impl Write for Request<Streaming>
impl Write for Request<Streaming>
source§fn write(&mut self, msg: &[u8]) -> Result<usize>
fn write(&mut self, msg: &[u8]) -> Result<usize>
Write a buffer into this writer, returning how many bytes were written. Read more
source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered
contents reach their destination. Read more
source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector)1.0.0 · source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
write_all_vectored)Attempts to write multiple buffers into this writer. Read more
Auto Trait Implementations§
impl<W> !RefUnwindSafe for Request<W>
impl<W> Send for Request<W>where
W: Send,
impl<W> !Sync for Request<W>
impl<W> Unpin for Request<W>where
W: Unpin,
impl<W> !UnwindSafe for Request<W>
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