tokio_proto/streaming/pipeline/
mod.rs1use std::io;
6use futures::{Stream, Sink};
7use tokio_core::io as old_io;
8use tokio_io as new_io;
9
10mod frame;
11pub use self::frame::Frame;
12
13mod client;
14pub use self::client::ClientProto;
15
16mod server;
17pub use self::server::ServerProto;
18
19pub mod advanced;
20
21#[derive(Debug)]
26pub struct StreamingPipeline<B>(B);
27
28pub trait Transport: 'static +
32 Stream<Error = io::Error> +
33 Sink<SinkError = io::Error>
34{
35 fn tick(&mut self) {}
41
42 fn cancel(&mut self) -> io::Result<()> {
44 Ok(())
45 }
46}
47
48impl<T, C> Transport for old_io::Framed<T,C>
49 where T: old_io::Io + 'static,
50 C: old_io::Codec + 'static,
51{}
52
53impl<T, C> Transport for new_io::codec::Framed<T,C>
54 where T: new_io::AsyncRead + new_io::AsyncWrite + 'static,
55 C: new_io::codec::Encoder<Error=io::Error> +
56 new_io::codec::Decoder<Error=io::Error> + 'static,
57{}