@@ -3,12 +3,15 @@ use futures_01::executor::{
33 Spawn as Spawn01 , UnsafeNotify as UnsafeNotify01 ,
44} ;
55use futures_01:: {
6- Async as Async01 , AsyncSink as AsyncSink01 , Future as Future01 ,
7- Sink as Sink01 , Stream as Stream01 ,
6+ Async as Async01 , Future as Future01 ,
7+ Stream as Stream01 ,
88} ;
9+ #[ cfg( feature = "sink" ) ]
10+ use futures_01:: { AsyncSink as AsyncSink01 , Sink as Sink01 } ;
911use futures_core:: { task as task03, Future as Future03 , Stream as Stream03 } ;
1012use std:: pin:: Pin ;
1113use std:: task:: Context ;
14+ #[ cfg( feature = "sink" ) ]
1215use futures_sink:: Sink as Sink03 ;
1316
1417#[ cfg( feature = "io-compat" ) ]
@@ -101,6 +104,7 @@ pub trait Stream01CompatExt: Stream01 {
101104impl < St : Stream01 > Stream01CompatExt for St { }
102105
103106/// Extension trait for futures 0.1 [`Sink`](futures_01::sink::Sink)
107+ #[ cfg( feature = "sink" ) ]
104108pub trait Sink01CompatExt : Sink01 {
105109 /// Converts a futures 0.1
106110 /// [`Sink<SinkItem = T, SinkError = E>`](futures_01::sink::Sink)
@@ -129,6 +133,7 @@ pub trait Sink01CompatExt: Sink01 {
129133 Compat01As03Sink :: new ( self )
130134 }
131135}
136+ #[ cfg( feature = "sink" ) ]
132137impl < Si : Sink01 > Sink01CompatExt for Si { }
133138
134139fn poll_01_to_03 < T , E > ( x : Result < Async01 < T > , E > ) -> task03:: Poll < Result < T , E > > {
@@ -165,6 +170,7 @@ impl<St: Stream01> Stream03 for Compat01As03<St> {
165170}
166171
167172/// Converts a futures 0.1 Sink object to a futures 0.3-compatible version
173+ #[ cfg( feature = "sink" ) ]
168174#[ derive( Debug ) ]
169175#[ must_use = "sinks do nothing unless polled" ]
170176pub struct Compat01As03Sink < S , SinkItem > {
@@ -173,8 +179,10 @@ pub struct Compat01As03Sink<S, SinkItem> {
173179 pub ( crate ) close_started : bool ,
174180}
175181
182+ #[ cfg( feature = "sink" ) ]
176183impl < S , SinkItem > Unpin for Compat01As03Sink < S , SinkItem > { }
177184
185+ #[ cfg( feature = "sink" ) ]
178186impl < S , SinkItem > Compat01As03Sink < S , SinkItem > {
179187 /// Wraps a futures 0.1 Sink object in a futures 0.3-compatible wrapper.
180188 pub fn new ( inner : S ) -> Compat01As03Sink < S , SinkItem > {
@@ -200,6 +208,7 @@ impl<S, SinkItem> Compat01As03Sink<S, SinkItem> {
200208 }
201209}
202210
211+ #[ cfg( feature = "sink" ) ]
203212impl < S , SinkItem > Stream03 for Compat01As03Sink < S , SinkItem >
204213where
205214 S : Stream01 ,
@@ -218,6 +227,7 @@ where
218227 }
219228}
220229
230+ #[ cfg( feature = "sink" ) ]
221231impl < S , SinkItem > Sink03 < SinkItem > for Compat01As03Sink < S , SinkItem >
222232where
223233 S : Sink01 < SinkItem = SinkItem > ,
0 commit comments