8
8
#![ doc( html_root_url = "https://rust-lang-nursery.github.io/futures-api-docs/0.3.0-alpha.12/futures_sink" ) ]
9
9
10
10
#![ feature( futures_api) ]
11
+ #![ cfg_attr( all( feature = "alloc" , not( feature = "std" ) ) , feature( alloc) ) ]
12
+
13
+ #[ cfg( all( feature = "alloc" , not( any( feature = "std" , feature = "nightly" ) ) ) ) ]
14
+ compile_error ! ( "The `alloc` feature without `std` requires the `nightly` feature active to explicitly opt-in to unstable features" ) ;
11
15
12
16
use futures_core:: task:: { LocalWaker , Poll } ;
13
17
use core:: pin:: Pin ;
@@ -155,16 +159,16 @@ impl<'a, S: ?Sized + Sink> Sink for Pin<&'a mut S> {
155
159
#[ cfg( feature = "std" ) ]
156
160
mod channel_impls;
157
161
158
- #[ cfg( feature = "std " ) ]
159
- mod if_std {
162
+ #[ cfg( feature = "alloc " ) ]
163
+ mod if_alloc {
160
164
use super :: * ;
161
165
162
166
/// The error type for `Vec` and `VecDequeue` when used as `Sink`s.
163
167
/// Values of this type can never be created.
164
168
#[ derive( Copy , Clone , Debug ) ]
165
169
pub enum VecSinkError { }
166
170
167
- impl < T > Sink for :: std :: vec:: Vec < T > {
171
+ impl < T > Sink for :: alloc :: vec:: Vec < T > {
168
172
type SinkItem = T ;
169
173
type SinkError = VecSinkError ;
170
174
@@ -187,7 +191,7 @@ mod if_std {
187
191
}
188
192
}
189
193
190
- impl < T > Sink for :: std :: collections:: VecDeque < T > {
194
+ impl < T > Sink for :: alloc :: collections:: VecDeque < T > {
191
195
type SinkItem = T ;
192
196
type SinkError = VecSinkError ;
193
197
@@ -210,7 +214,7 @@ mod if_std {
210
214
}
211
215
}
212
216
213
- impl < S : ?Sized + Sink + Unpin > Sink for :: std :: boxed:: Box < S > {
217
+ impl < S : ?Sized + Sink + Unpin > Sink for :: alloc :: boxed:: Box < S > {
214
218
type SinkItem = S :: SinkItem ;
215
219
type SinkError = S :: SinkError ;
216
220
@@ -232,8 +236,8 @@ mod if_std {
232
236
}
233
237
}
234
238
235
- #[ cfg( feature = "std " ) ]
236
- pub use self :: if_std :: * ;
239
+ #[ cfg( feature = "alloc " ) ]
240
+ pub use self :: if_alloc :: * ;
237
241
238
242
#[ cfg( feature = "either" ) ]
239
243
use either:: Either ;
0 commit comments