1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-31 17:07:01 +02:00

use From/Into instead of custom IntoService and IntoNewService traits

This commit is contained in:
Nikolay Kim
2018-09-04 09:30:52 -07:00
parent 42a49da199
commit 9441624827
7 changed files with 25 additions and 72 deletions

View File

@@ -2,7 +2,7 @@ use futures::unsync::mpsc;
use futures::{Async, Future, Poll, Stream};
use tokio::executor::current_thread::spawn;
use super::{IntoService, Service};
use super::Service;
pub struct StreamDispatcher<S: Stream, T> {
stream: S,
@@ -18,12 +18,12 @@ where
T: Service<Request = Result<S::Item, S::Error>, Response = (), Error = ()>,
T::Future: 'static,
{
pub fn new<F: IntoService<T>>(stream: S, service: F) -> Self {
pub fn new<F: Into<T>>(stream: S, service: F) -> Self {
let (stop_tx, stop_rx) = mpsc::unbounded();
StreamDispatcher {
stream,
item: None,
service: service.into_service(),
service: service.into(),
stop_rx,
stop_tx,
}