Notes on a perhaps better Body.

This commit is contained in:
Sergio Benitez 2016-03-15 00:47:03 -07:00
parent dcb150bde7
commit c6e8cd47da
1 changed files with 4 additions and 0 deletions

View File

@ -2,6 +2,10 @@ pub use hyper::status::StatusCode;
pub use hyper::header::{self, Headers}; pub use hyper::header::{self, Headers};
use std::io::Read; use std::io::Read;
// Consider simply having Body be a trait, `RocketBody`, with one function that
// takes in a prepped up HypResponse and acts on it. Then, `Response` changes
// to be a Response<T: RocketBody> { body: T } and the Rocket HypHandler
// simply sets up the status codes, headers, and calls body.fn(res).
pub enum Body<'a> { pub enum Body<'a> {
Bytes(&'a [u8]), Bytes(&'a [u8]),
Str(&'a str), Str(&'a str),