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