Struct backtalk::Reply
[−]
[src]
pub struct Reply { /* fields omitted */ }
A successful response with JSON data to be sent back to the client.
There are two kinds of replies. Static replies represent JSON data that is ready. Most requests
return static replies. Streaming replies represent a stream of JSON data that will stream from
a Channel
directly to the client. You can't access the data of a streaming reply through the
Reply
struct, since it's not ready yet. If you want to transform or edit the reply data for a
stream, you'll need to implement a custom Channel
instead.
These are several ways to create a Reply:
- pass a Request to an Adapter to get a static response from a database
- pass a Request to a Channel to get a streaming response
- in your custom Resource, call
request.into_reply(data)
to create a Reply object.
Reply implements IntoFuture
, so you can return it directly from a and_then
block.
Methods
impl Reply
[src]
fn data(&self) -> Option<&JsonObject>
fn data_mut(&mut self) -> Option<&mut JsonObject>
fn to_http(self) -> Response<Body>
fn method(&self) -> Method
fn resource(&self) -> &str
fn id(&self) -> &Option<String>
fn params(&self) -> &JsonObject
fn param(&self, key: &str) -> &JsonValue
fn boxed(self) -> BoxFuture<Reply, Error>
fn request_data(&self) -> &JsonObject
Trait Implementations
impl Debug for Reply
[src]
impl IntoFuture for Reply
[src]
type Item = Reply
The item that the future may resolve with.
type Error = Error
The error that the future may resolve with.
type Future = FutureResult<Reply, Error>
The future that this type can be converted into.
fn into_future(self) -> Self::Future
Consumes this object and produces a future.