22
33use std:: fmt:: Debug ;
44use std:: io:: { Error as IoError } ;
5- use std:: time:: Duration ;
65
76use futures:: { Future , Sink , Stream } ;
8- use tokio:: util:: FutureExt ;
9- use tokio:: timer:: timeout:: Error as TimeoutError ;
107
118/// A convenience typedef around a `Future` whose error component is `io::Error`
129pub type IoFuture < T > = Box < Future < Item = T , Error = IoError > + Send > ;
@@ -24,14 +21,6 @@ pub fn send_to<T: Send + 'static, Tx, E: Debug>(tx: &Tx, v: T) -> impl Future<It
2421 . map ( |_tx| ( ) ) // ignore tx because it was cloned
2522}
2623
27- /// Send item to a sink using reference with timeout
28- pub fn send_to_bounded < T : Send + ' static , Tx , E : Debug > ( tx : & Tx , v : T , timeout : Duration ) -> impl Future < Item =( ) , Error =TimeoutError < E > > + Send
29- where Tx : Sink < SinkItem = T , SinkError = E > + Send + Clone + ' static
30- {
31- send_to ( tx, v)
32- . timeout ( timeout)
33- }
34-
3524/// Send item to a sink using reference
3625pub fn send_all_to < T : Send + ' static , S , Tx , E : Debug > ( tx : & Tx , s : S ) -> impl Future < Item =( ) , Error =E > + Send
3726 where S : Stream < Item = T , Error = E > + Send + ' static ,
@@ -43,11 +32,3 @@ pub fn send_all_to<T: Send + 'static, S, Tx, E: Debug>(tx: &Tx, s: S) -> impl Fu
4332 . map ( |_tx| ( ) ) // ignore tx because it was cloned
4433}
4534
46- /// Send item to a sink using reference with timeout
47- pub fn send_all_to_bounded < T : Send + ' static , S , Tx , E : Debug > ( tx : & Tx , s : S , timeout : Duration ) -> impl Future < Item =( ) , Error =TimeoutError < E > > + Send
48- where S : Stream < Item = T , Error = E > + Send + ' static ,
49- Tx : Sink < SinkItem = T , SinkError = E > + Send + Clone + ' static
50- {
51- send_all_to ( tx, s)
52- . timeout ( timeout)
53- }
0 commit comments