mirror of
https://github.com/fafhrd91/actix-net
synced 2025-01-18 09:41:49 +01:00
use IntoFuture instead of Future
This commit is contained in:
parent
ed14e6b8ea
commit
15dafeff3d
@ -1,5 +1,12 @@
|
||||
# Changes
|
||||
|
||||
## [0.3.2] - 2019-03-04
|
||||
|
||||
### Changed
|
||||
|
||||
* Use IntoFuture for new services
|
||||
|
||||
|
||||
## [0.3.1] - 2019-03-04
|
||||
|
||||
### Changed
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "actix-utils"
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||
description = "Actix utils - various actix net related services"
|
||||
keywords = ["network", "framework", "async", "futures"]
|
||||
@ -18,7 +18,7 @@ name = "actix_utils"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
actix-service = "0.3.1"
|
||||
actix-service = "0.3.2"
|
||||
actix-codec = "0.1.0"
|
||||
bytes = "0.4"
|
||||
futures = "0.1.24"
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Contains `Either` service and related types and functions.
|
||||
use actix_service::{NewService, Service};
|
||||
use futures::{future, try_ready, Async, Future, Poll};
|
||||
use futures::{future, try_ready, Async, Future, IntoFuture, Poll};
|
||||
|
||||
/// Combine two different service types into a single type.
|
||||
///
|
||||
@ -102,8 +102,8 @@ where
|
||||
|
||||
fn new_service(&self, cfg: &C) -> Self::Future {
|
||||
match self {
|
||||
Either::A(ref inner) => EitherNewService::A(inner.new_service(cfg)),
|
||||
Either::B(ref inner) => EitherNewService::B(inner.new_service(cfg)),
|
||||
Either::A(ref inner) => EitherNewService::A(inner.new_service(cfg).into_future()),
|
||||
Either::B(ref inner) => EitherNewService::B(inner.new_service(cfg).into_future()),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -119,8 +119,8 @@ impl<A: Clone, B: Clone> Clone for Either<A, B> {
|
||||
|
||||
#[doc(hidden)]
|
||||
pub enum EitherNewService<A: NewService<C>, B: NewService<C>, C> {
|
||||
A(A::Future),
|
||||
B(B::Future),
|
||||
A(<A::Future as IntoFuture>::Future),
|
||||
B(<B::Future as IntoFuture>::Future),
|
||||
}
|
||||
|
||||
impl<A, B, C> Future for EitherNewService<A, B, C>
|
||||
|
@ -7,7 +7,7 @@ use actix_codec::{AsyncRead, AsyncWrite, Decoder, Encoder, Framed};
|
||||
use actix_service::{IntoNewService, IntoService, NewService, Service};
|
||||
use futures::future::{ok, FutureResult};
|
||||
use futures::task::AtomicTask;
|
||||
use futures::{Async, Future, Poll, Sink, Stream};
|
||||
use futures::{Async, Future, IntoFuture, Poll, Sink, Stream};
|
||||
use log::debug;
|
||||
|
||||
use crate::cell::Cell;
|
||||
@ -120,7 +120,7 @@ where
|
||||
|
||||
fn call(&mut self, req: Framed<T, U>) -> Self::Future {
|
||||
FramedServiceResponseFuture {
|
||||
fut: self.factory.new_service(&self.config),
|
||||
fut: self.factory.new_service(&self.config).into_future(),
|
||||
framed: Some(req),
|
||||
}
|
||||
}
|
||||
@ -137,7 +137,7 @@ where
|
||||
<U as Encoder>::Item: 'static,
|
||||
<U as Encoder>::Error: std::fmt::Debug,
|
||||
{
|
||||
fut: S::Future,
|
||||
fut: <S::Future as IntoFuture>::Future,
|
||||
framed: Option<Framed<T, U>>,
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ use std::rc::Rc;
|
||||
use actix_service::{IntoNewService, IntoService, NewService, Service};
|
||||
use futures::future::{ok, Future, FutureResult};
|
||||
use futures::unsync::mpsc;
|
||||
use futures::{Async, Poll, Stream};
|
||||
use futures::{Async, IntoFuture, Poll, Stream};
|
||||
|
||||
type Request<T> = Result<<T as IntoStream>::Item, <T as IntoStream>::Error>;
|
||||
|
||||
@ -113,6 +113,7 @@ where
|
||||
Box::new(
|
||||
self.factory
|
||||
.new_service(&self.config)
|
||||
.into_future()
|
||||
.and_then(move |srv| StreamDispatcher::new(req, srv)),
|
||||
)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user