mirror of
https://github.com/fafhrd91/actix-net
synced 2025-03-20 18:25:18 +01:00
remove ClonableService
This commit is contained in:
parent
311bb14d97
commit
41145040e1
@ -1,5 +1,12 @@
|
|||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
|
## [0.4.5] - 2019-07-19
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
* Deprecated `CloneableService` as it is not safe
|
||||||
|
|
||||||
|
|
||||||
## [0.4.4] - 2019-07-17
|
## [0.4.4] - 2019-07-17
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "actix-utils"
|
name = "actix-utils"
|
||||||
version = "0.4.4"
|
version = "0.4.5"
|
||||||
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||||
description = "Actix utils - various actix net related services"
|
description = "Actix utils - various actix net related services"
|
||||||
keywords = ["network", "framework", "async", "futures"]
|
keywords = ["network", "framework", "async", "futures"]
|
||||||
|
@ -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<T> {
|
|
||||||
service: Cell<T>,
|
|
||||||
_t: PhantomData<Rc<()>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T> CloneableService<T> {
|
|
||||||
pub fn new(service: T) -> Self
|
|
||||||
where
|
|
||||||
T: Service,
|
|
||||||
{
|
|
||||||
Self {
|
|
||||||
service: Cell::new(service),
|
|
||||||
_t: PhantomData,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T> Clone for CloneableService<T> {
|
|
||||||
fn clone(&self) -> Self {
|
|
||||||
Self {
|
|
||||||
service: self.service.clone(),
|
|
||||||
_t: PhantomData,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T> Service for CloneableService<T>
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
//! Actix utils - various helper services
|
//! Actix utils - various helper services
|
||||||
|
|
||||||
mod cell;
|
mod cell;
|
||||||
pub mod cloneable;
|
|
||||||
pub mod counter;
|
pub mod counter;
|
||||||
pub mod either;
|
pub mod either;
|
||||||
pub mod framed;
|
pub mod framed;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user