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: Url
The target URI for this request.
version: HttpVersion
The 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>
Writes a buffer into this writer, returning how many bytes were written. Read more
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flushes 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> Freeze for Request<W>
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