From 41145040e142726707ba50eff3cac5646f13a771 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Fri, 19 Jul 2019 11:03:16 +0600 Subject: [PATCH] remove ClonableService --- actix-utils/CHANGES.md | 7 +++++ actix-utils/Cargo.toml | 2 +- actix-utils/src/cloneable.rs | 55 ------------------------------------ actix-utils/src/lib.rs | 2 +- 4 files changed, 9 insertions(+), 57 deletions(-) delete mode 100644 actix-utils/src/cloneable.rs diff --git a/actix-utils/CHANGES.md b/actix-utils/CHANGES.md index 87c583d6..97131b76 100644 --- a/actix-utils/CHANGES.md +++ b/actix-utils/CHANGES.md @@ -1,5 +1,12 @@ # Changes +## [0.4.5] - 2019-07-19 + +### Removed + +* Deprecated `CloneableService` as it is not safe + + ## [0.4.4] - 2019-07-17 ### Changed diff --git a/actix-utils/Cargo.toml b/actix-utils/Cargo.toml index f464ba82..f4f11ab6 100644 --- a/actix-utils/Cargo.toml +++ b/actix-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-utils" -version = "0.4.4" +version = "0.4.5" authors = ["Nikolay Kim "] description = "Actix utils - various actix net related services" keywords = ["network", "framework", "async", "futures"] diff --git a/actix-utils/src/cloneable.rs b/actix-utils/src/cloneable.rs deleted file mode 100644 index 2ad9ac8f..00000000 --- a/actix-utils/src/cloneable.rs +++ /dev/null @@ -1,55 +0,0 @@ -#![allow(deprecated)] -use std::marker::PhantomData; -use std::rc::Rc; - -use actix_service::Service; -use futures::Poll; - -use super::cell::Cell; - -#[doc(hidden)] -#[deprecated(since = "0.4.3", note = "support will be removed in actix-utils 0.4.5")] -/// Service that allows to turn non-clone service to a service with `Clone` impl -pub struct CloneableService { - service: Cell, - _t: PhantomData>, -} - -impl CloneableService { - pub fn new(service: T) -> Self - where - T: Service, - { - Self { - service: Cell::new(service), - _t: PhantomData, - } - } -} - -impl Clone for CloneableService { - fn clone(&self) -> Self { - Self { - service: self.service.clone(), - _t: PhantomData, - } - } -} - -impl Service for CloneableService -where - T: Service, -{ - type Request = T::Request; - type Response = T::Response; - type Error = T::Error; - type Future = T::Future; - - fn poll_ready(&mut self) -> Poll<(), Self::Error> { - self.service.get_mut().poll_ready() - } - - fn call(&mut self, req: T::Request) -> Self::Future { - self.service.get_mut().call(req) - } -} diff --git a/actix-utils/src/lib.rs b/actix-utils/src/lib.rs index c49ddab2..9d1a6b48 100644 --- a/actix-utils/src/lib.rs +++ b/actix-utils/src/lib.rs @@ -1,6 +1,6 @@ //! Actix utils - various helper services + mod cell; -pub mod cloneable; pub mod counter; pub mod either; pub mod framed;