use actix_net::codec::Framed; use actix_net::framed::{FramedTransport, FramedTransportError}; use actix_net::service::{IntoService, Service}; use futures::{Future, Poll}; use tokio_io::{AsyncRead, AsyncWrite}; use super::{Codec, Message}; pub struct Transport where S: Service, 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() } }