Trait hyper::http::message::HttpMessage [−][src]
pub trait HttpMessage: Write + Read + Send + Any + Typeable + Debug {
fn set_outgoing(&mut self, head: RequestHead) -> Result<RequestHead>;
fn get_incoming(&mut self) -> Result<ResponseHead>;
fn set_read_timeout(&self, dur: Option<Duration>) -> Result<()>;
fn set_write_timeout(&self, dur: Option<Duration>) -> Result<()>;
fn close_connection(&mut self) -> Result<()>;
fn has_body(&self) -> bool;
fn set_proxied(&mut self, val: bool) { ... }
}
Expand description
The trait provides an API for sending an receiving HTTP messages.
Required methods
fn set_outgoing(&mut self, head: RequestHead) -> Result<RequestHead>
fn set_outgoing(&mut self, head: RequestHead) -> Result<RequestHead>
Initiates a new outgoing request.
Only the request’s head is provided (in terms of the RequestHead
struct).
After this, the HttpMessage
instance can be used as an io::Write
in order to write the
body of the request.
fn get_incoming(&mut self) -> Result<ResponseHead>
fn get_incoming(&mut self) -> Result<ResponseHead>
Obtains the incoming response and returns its head (i.e. the ResponseHead
struct)
After this, the HttpMessage
instance can be used as an io::Read
in order to read out
the response body.
Set the read timeout duration for this message.
Set the write timeout duration for this message.
fn close_connection(&mut self) -> Result<()>
fn close_connection(&mut self) -> Result<()>
Closes the underlying HTTP connection.
Provided methods
fn set_proxied(&mut self, val: bool)
fn set_proxied(&mut self, val: bool)
Called when the Client wishes to use a Proxy.
Implementations
If the underlying type is T, get a reference to the contained data.
If the underlying type is T, get a mutable reference to the contained data.
If the underlying type is T, extract it.