Struct hyper::client::request::Request [−][src]
pub struct Request<W> { pub url: Url, pub version: HttpVersion, // some fields omitted }
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.
Methods
impl<W> Request<W>
[src]
impl<W> Request<W>
pub fn headers(&self) -> &Headers
[src]
pub fn headers(&self) -> &Headers
Read the Request headers.
pub fn method(&self) -> Method
[src]
pub fn method(&self) -> Method
Read the Request method.
pub fn set_write_timeout(&self, dur: Option<Duration>) -> Result<()>
[src]
pub fn set_write_timeout(&self, dur: Option<Duration>) -> Result<()>
Set the write timeout.
pub fn set_read_timeout(&self, dur: Option<Duration>) -> Result<()>
[src]
pub fn set_read_timeout(&self, dur: Option<Duration>) -> Result<()>
Set the read timeout.
impl Request<Fresh>
[src]
impl Request<Fresh>
pub fn with_message(
method: Method,
url: Url,
message: Box<HttpMessage>
) -> Result<Request<Fresh>>
[src]
pub fn with_message(
method: Method,
url: Url,
message: Box<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).
pub fn new(method: Method, url: Url) -> Result<Request<Fresh>>
[src]
pub fn new(method: Method, url: Url) -> Result<Request<Fresh>>
Create a new client request.
pub fn with_connector<C, S>(
method: Method,
url: Url,
connector: &C
) -> Result<Request<Fresh>> where
C: NetworkConnector<Stream = S>,
S: Into<Box<NetworkStream + Send>>,
[src]
pub fn with_connector<C, S>(
method: Method,
url: Url,
connector: &C
) -> Result<Request<Fresh>> where
C: NetworkConnector<Stream = S>,
S: Into<Box<NetworkStream + Send>>,
Create a new client request with a specific underlying NetworkStream.
pub fn start(self) -> Result<Request<Streaming>>
[src]
pub fn start(self) -> Result<Request<Streaming>>
Consume a Fresh Request, writing the headers and method, returning a Streaming Request.
pub fn headers_mut(&mut self) -> &mut Headers
[src]
pub fn headers_mut(&mut self) -> &mut Headers
Get a mutable reference to the Request headers.
impl Request<Streaming>
[src]
impl Request<Streaming>
pub fn send(self) -> Result<Response>
[src]
pub fn send(self) -> Result<Response>
Completes writing the request, and returns a response to read from.
Consumes the Request.
Trait Implementations
impl Write for Request<Streaming>
[src]
impl Write for Request<Streaming>
fn write(&mut self, msg: &[u8]) -> Result<usize>
[src]
fn write(&mut self, msg: &[u8]) -> Result<usize>
Write a buffer into this object, returning how many bytes were written. Read more
fn flush(&mut self) -> Result<()>
[src]
fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0[src]
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this write. Read more
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0[src]
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
Writes a formatted string into this writer, returning any error encountered. Read more
ⓘImportant traits for &'a mut Rfn by_ref(&mut self) -> &mut Self
1.0.0[src]
fn by_ref(&mut self) -> &mut Self
Creates a "by reference" adaptor for this instance of Write
. Read more