From feac0b43d9ae69b82dd26278f4fb85526ac51f5a Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Fri, 29 Mar 2019 10:21:17 -0700 Subject: [PATCH] add impl Service for Rc> --- actix-service/CHANGES.md | 7 +++++++ actix-service/src/lib.rs | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/actix-service/CHANGES.md b/actix-service/CHANGES.md index 616fd0ba..5c913ed8 100644 --- a/actix-service/CHANGES.md +++ b/actix-service/CHANGES.md @@ -1,5 +1,12 @@ # Changes +## [0.3.5] - 2019-04-xx + +### Added + +* Add `impl Service for Rc>` + + ## [0.3.4] - 2019-03-12 ### Added diff --git a/actix-service/src/lib.rs b/actix-service/src/lib.rs index 1f441266..3b1e6e38 100644 --- a/actix-service/src/lib.rs +++ b/actix-service/src/lib.rs @@ -1,3 +1,4 @@ +use std::cell::RefCell; use std::rc::Rc; use std::sync::Arc; @@ -391,6 +392,24 @@ where } } +impl Service for Rc> +where + S: Service, +{ + type Request = S::Request; + type Response = S::Response; + type Error = S::Error; + type Future = S::Future; + + fn poll_ready(&mut self) -> Poll<(), S::Error> { + self.borrow_mut().poll_ready() + } + + fn call(&mut self, request: Self::Request) -> S::Future { + self.borrow_mut().call(request) + } +} + impl NewService for Rc where S: NewService,