Trait api::Api
[−]
[src]
pub trait Api { type Reply; type Body: Read; type Error; fn method(&self) -> Method; fn path(&self) -> String; fn query(&self) -> Query; fn headers(&self) -> Headers; fn body(&self) -> Self::Body; fn parse<Resp>(&self, _: &mut Resp) -> Result<Self::Reply, Self::Error>
where
Resp: HttpResponse; }
Api
represents a HTTP API exposing all the request parameters
and a function to parse the HTTP response.
Associated Types
Required Methods
fn method(&self) -> Method
Return the HTTP method used by this API.
fn path(&self) -> String
Return the URL path for this API request.
fn query(&self) -> Query
Return the URL query for this API request.
fn headers(&self) -> Headers
Return the headers for this HTTP request.
fn body(&self) -> Self::Body
Return the body of this HTTP request. If the request
doesn't expect any body (i.e. GET), it should return
std::io::Empty
.
fn parse<Resp>(&self, _: &mut Resp) -> Result<Self::Reply, Self::Error> where
Resp: HttpResponse,
Resp: HttpResponse,
Parse the HTTP response, received from the actual client,
into the type Reply
.