mirror of
https://github.com/fafhrd91/actix-web
synced 2025-08-31 00:50:20 +02:00
add String and Bytes extractor
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use std::ops::Deref;
|
||||
use std::marker::PhantomData;
|
||||
use futures::Poll;
|
||||
use futures::future::{Future, FutureResult, ok, err};
|
||||
|
||||
use error::Error;
|
||||
@@ -96,6 +97,21 @@ impl<A, B> Responder for Either<A, B>
|
||||
}
|
||||
}
|
||||
|
||||
impl<A, B, I, E> Future for Either<A, B>
|
||||
where A: Future<Item=I, Error=E>,
|
||||
B: Future<Item=I, Error=E>,
|
||||
{
|
||||
type Item = I;
|
||||
type Error = E;
|
||||
|
||||
fn poll(&mut self) -> Poll<I, E> {
|
||||
match *self {
|
||||
Either::A(ref mut fut) => fut.poll(),
|
||||
Either::B(ref mut fut) => fut.poll(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Convenience trait that converts `Future` object to a `Boxed` future
|
||||
///
|
||||
/// For example loading json from request's body is async operation.
|
||||
|
Reference in New Issue
Block a user