use pin_project_lite. remove unused mods. update changelog

This commit is contained in:
fakeshadow 2020-12-27 04:30:27 +08:00
parent 3063c8e167
commit 8e94459ff7
5 changed files with 39 additions and 50 deletions

View File

@ -1,8 +1,10 @@
# Changes # Changes
## Unreleased - 2020-xx-xx ## Unreleased - 2020-xx-xx
* Upgrade `pin-project` to `1.0`. * Use `pin-project-lite` to replace `pin-project`. [#229]
* Deprecated `condition`,`either`,`inflight`,`keepalive`,`oneshot`,`order`,`stream` and `time` mod. * Remove `condition`,`either`,`inflight`,`keepalive`,`oneshot`,`order`,`stream` and `time` mods. [#229]
[#229]: https://github.com/actix/actix-net/pull/229
## 2.0.0 - 2020-08-23 ## 2.0.0 - 2020-08-23
* No changes from beta 1. * No changes from beta 1.

View File

@ -1,6 +1,6 @@
[package] [package]
name = "actix-utils" name = "actix-utils"
version = "2.0.0" version = "3.0.0"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"] authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Various network related services and utilities for the Actix ecosystem." description = "Various network related services and utilities for the Actix ecosystem."
keywords = ["network", "framework", "async", "futures"] keywords = ["network", "framework", "async", "futures"]
@ -20,10 +20,10 @@ actix-codec = "0.3.0"
actix-rt = "1.1.1" actix-rt = "1.1.1"
actix-service = "1.0.6" actix-service = "1.0.6"
futures-core = { version = "0.3.4", default-features = false } futures-core = { version = "0.3.7", default-features = false }
futures-sink = { version = "0.3.4", default-features = false } futures-sink = { version = "0.3.7", default-features = false }
log = "0.4" log = "0.4"
pin-project = "1.0.0" pin-project-lite = "0.2.0"
[dev-dependencies] [dev-dependencies]
futures-util = { version = "0.3.4", default-features = false } futures-util = { version = "0.3.7", default-features = false }

View File

@ -62,25 +62,28 @@ pub enum Message<T> {
Close, Close,
} }
/// Dispatcher is a future that reads frames from Framed object pin_project_lite::pin_project! {
/// and passes them to the service. /// Dispatcher is a future that reads frames from Framed object
#[pin_project::pin_project] /// and passes them to the service.
pub struct Dispatcher<S, T, U, I> pub struct Dispatcher<S, T, U, I>
where where
S: Service<Request = <U as Decoder>::Item, Response = I>, S: Service<Request = <U as Decoder>::Item, Response = I>,
S::Error: 'static, S::Error: 'static,
S::Future: 'static, S::Future: 'static,
T: AsyncRead + AsyncWrite, T: AsyncRead,
U: Encoder<I> + Decoder, T: AsyncWrite,
I: 'static, U: Encoder<I>,
<U as Encoder<I>>::Error: fmt::Debug, U: Decoder,
{ I: 'static,
service: S, <U as Encoder<I>>::Error: fmt::Debug,
state: State<S, U, I>, {
#[pin] service: S,
framed: Framed<T, U>, state: State<S, U, I>,
rx: mpsc::Receiver<Result<Message<I>, S::Error>>, #[pin]
tx: mpsc::Sender<Result<Message<I>, S::Error>>, framed: Framed<T, U>,
rx: mpsc::Receiver<Result<Message<I>, S::Error>>,
tx: mpsc::Sender<Result<Message<I>, S::Error>>,
}
} }
enum State<S: Service, U: Encoder<I> + Decoder, I> { enum State<S: Service, U: Encoder<I> + Decoder, I> {

View File

@ -10,20 +10,3 @@ pub mod dispatcher;
pub mod mpsc; pub mod mpsc;
pub mod task; pub mod task;
pub mod timeout; pub mod timeout;
#[deprecated(since = "2.1.0", note = "actix_utils::condition has been removed")]
pub mod condition {}
#[deprecated(since = "2.1.0", note = "actix_utils::either has been removed")]
pub mod either {}
#[deprecated(since = "2.1.0", note = "actix_utils::inflight has been removed")]
pub mod inflight {}
#[deprecated(since = "2.1.0", note = "actix_utils::keepalive has been removed")]
pub mod keepalive {}
#[deprecated(since = "2.1.0", note = "actix_utils::oneshot has been removed")]
pub mod oneshot {}
#[deprecated(since = "2.1.0", note = "actix_utils::order has been removed")]
pub mod order {}
#[deprecated(since = "2.1.0", note = "actix_utils::stream has been removed")]
pub mod stream {}
#[deprecated(since = "2.1.0", note = "actix_utils::time has been removed")]
pub mod time {}

View File

@ -159,13 +159,14 @@ where
} }
} }
/// `TimeoutService` response future pin_project_lite::pin_project! {
#[pin_project::pin_project] /// `TimeoutService` response future
#[derive(Debug)] #[derive(Debug)]
pub struct TimeoutServiceResponse<T: Service> { pub struct TimeoutServiceResponse<T: Service> {
#[pin] #[pin]
fut: T::Future, fut: T::Future,
sleep: Delay, sleep: Delay,
}
} }
impl<T> Future for TimeoutServiceResponse<T> impl<T> Future for TimeoutServiceResponse<T>