mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 07:53:00 +01:00
unhide AsyncResponder; remove unused code
This commit is contained in:
parent
d80b84c915
commit
3ccaa04575
@ -97,9 +97,33 @@ impl<A, B> Responder for Either<A, B>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[doc(hidden)]
|
||||
/// Convenience trait that convert `Future` object into `Boxed` future
|
||||
///
|
||||
/// For example loading json from request's body is async operation.
|
||||
///
|
||||
/// ```rust
|
||||
/// # extern crate actix_web;
|
||||
/// # extern crate futures;
|
||||
/// # #[macro_use] extern crate serde_derive;
|
||||
/// use actix_web::*;
|
||||
/// use futures::future::Future;
|
||||
///
|
||||
/// #[derive(Deserialize, Debug)]
|
||||
/// struct MyObj {
|
||||
/// name: String,
|
||||
/// }
|
||||
///
|
||||
/// fn index(mut req: HttpRequest) -> Box<Future<Item=HttpResponse, Error=Error>> {
|
||||
/// req.json() // <- get JsonBody future
|
||||
/// .from_err()
|
||||
/// .and_then(|val: MyObj| { // <- deserialized value
|
||||
/// Ok(httpcodes::HttpOk.into())
|
||||
/// })
|
||||
/// // Construct boxed future by using `AsyncResponder::responder()` method
|
||||
/// .responder()
|
||||
/// }
|
||||
/// # fn main() {}
|
||||
/// ```
|
||||
pub trait AsyncResponder<I, E>: Sized {
|
||||
fn responder(self) -> Box<Future<Item=I, Error=E>>;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
use std::{mem, ptr, slice};
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::collections::VecDeque;
|
||||
use bytes::{BufMut, BytesMut};
|
||||
use http::Version;
|
||||
@ -50,21 +49,6 @@ impl Drop for SharedHttpInnerMessage {
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for SharedHttpInnerMessage {
|
||||
type Target = HttpInnerMessage;
|
||||
|
||||
fn deref(&self) -> &HttpInnerMessage {
|
||||
self.get_ref()
|
||||
}
|
||||
}
|
||||
|
||||
impl DerefMut for SharedHttpInnerMessage {
|
||||
|
||||
fn deref_mut(&mut self) -> &mut HttpInnerMessage {
|
||||
self.get_mut()
|
||||
}
|
||||
}
|
||||
|
||||
impl Clone for SharedHttpInnerMessage {
|
||||
|
||||
fn clone(&self) -> SharedHttpInnerMessage {
|
||||
|
Loading…
Reference in New Issue
Block a user