use actix_codec::{AsyncRead, AsyncWrite, Framed}; use actix_service::{IntoService, Service}; use actix_utils::framed::{FramedTransport, FramedTransportError}; use futures::{Future, Poll}; use super::{Codec, Frame, Message}; pub struct Transport where S: Service + 'static, T: AsyncRead + AsyncWrite, { inner: FramedTransport, } impl Transport where T: AsyncRead + AsyncWrite, S: Service, S::Future: 'static, S::Error: 'static, { pub fn new>(io: T, service: F) -> Self { Transport { inner: FramedTransport::new(Framed::new(io, Codec::new()), service), } } pub fn with>(framed: Framed, service: F) -> Self { Transport { inner: FramedTransport::new(framed, service), } } } impl Future for Transport where T: AsyncRead + AsyncWrite, S: Service, S::Future: 'static, S::Error: 'static, { type Item = (); type Error = FramedTransportError; fn poll(&mut self) -> Poll { self.inner.poll() } }