1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-08-23 05:15:11 +02:00

use IntoService types for transform services

This commit is contained in:
Nikolay Kim
2019-03-12 13:39:04 -07:00
parent 825117fd4c
commit 755d4958c5
5 changed files with 36 additions and 12 deletions

View File

@@ -3,7 +3,7 @@ use std::fmt;
use std::marker::PhantomData;
use std::rc::Rc;
use actix_service::{Service, Transform, Void};
use actix_service::{IntoService, Service, Transform, Void};
use futures::future::{ok, FutureResult};
use futures::task::AtomicTask;
use futures::unsync::oneshot;
@@ -112,9 +112,12 @@ where
S::Future: 'static,
S::Error: 'static,
{
pub fn new(service: S) -> Self {
pub fn new<U>(service: U) -> Self
where
U: IntoService<S>,
{
Self {
service,
service: service.into_service(),
acks: VecDeque::new(),
task: Rc::new(AtomicTask::new()),
}