@@ -27,7 +27,7 @@ use futures_core::Poll;
27
27
#[ derive( Copy , Clone , Debug , PartialEq ) ]
28
28
pub enum AsyncSink < T > {
29
29
/// The `start_send` attempt succeeded, so the sending process has
30
- /// *started*; you must use `Sink::poll_complete ` to drive the send
30
+ /// *started*; you must use `Sink::flush ` to drive the send
31
31
/// to completion.
32
32
Ready ,
33
33
@@ -83,7 +83,7 @@ if_std! {
83
83
Ok ( :: AsyncSink :: Ready )
84
84
}
85
85
86
- fn poll_complete ( & mut self ) -> Poll <( ) , Self :: SinkError > {
86
+ fn flush ( & mut self ) -> Poll <( ) , Self :: SinkError > {
87
87
Ok ( :: Async :: Ready ( ( ) ) )
88
88
}
89
89
@@ -105,8 +105,8 @@ if_std! {
105
105
( * * self ) . start_send( item)
106
106
}
107
107
108
- fn poll_complete ( & mut self ) -> Poll <( ) , Self :: SinkError > {
109
- ( * * self ) . poll_complete ( )
108
+ fn flush ( & mut self ) -> Poll <( ) , Self :: SinkError > {
109
+ ( * * self ) . flush ( )
110
110
}
111
111
112
112
fn close( & mut self ) -> Poll <( ) , Self :: SinkError > {
@@ -160,21 +160,21 @@ pub trait Sink {
160
160
/// until the buffer is fully flushed. Since sinks are designed to work with
161
161
/// asynchronous I/O, the process of actually writing out the data to an
162
162
/// underlying object takes place asynchronously. **You *must* use
163
- /// `poll_complete ` in order to drive completion of a send**. In particular,
163
+ /// `flush ` in order to drive completion of a send**. In particular,
164
164
/// `start_send` does not begin the flushing process
165
165
///
166
166
/// # Return value
167
167
///
168
168
/// This method returns `AsyncSink::Ready` if the sink was able to start
169
169
/// sending `item`. In that case, you *must* ensure that you call
170
- /// `poll_complete ` to process the sent item to completion. Note, however,
170
+ /// `flush ` to process the sent item to completion. Note, however,
171
171
/// that several calls to `start_send` can be made prior to calling
172
- /// `poll_complete `, which will work on completing all pending items.
172
+ /// `flush `, which will work on completing all pending items.
173
173
///
174
174
/// The method returns `AsyncSink::Pending` if the sink was unable to begin
175
175
/// sending, usually due to being full. The sink must have attempted to
176
176
/// complete processing any outstanding requests (equivalent to
177
- /// `poll_complete `) before yielding this result. The current task will be
177
+ /// `flush `) before yielding this result. The current task will be
178
178
/// automatically scheduled for notification when the sink may be ready to
179
179
/// receive new values.
180
180
///
@@ -190,7 +190,7 @@ pub trait Sink {
190
190
/// sink:
191
191
///
192
192
/// - It is called outside of the context of a task.
193
- /// - A previous call to `start_send` or `poll_complete ` yielded an error.
193
+ /// - A previous call to `start_send` or `flush ` yielded an error.
194
194
fn start_send ( & mut self , item : Self :: SinkItem )
195
195
-> StartSend < Self :: SinkItem , Self :: SinkError > ;
196
196
@@ -230,7 +230,7 @@ pub trait Sink {
230
230
/// This method may panic in a few situations, depending on the specific sink:
231
231
///
232
232
/// - It is called outside of the context of a task.
233
- /// - A previous call to `start_send` or `poll_complete ` yielded an error.
233
+ /// - A previous call to `start_send` or `flush ` yielded an error.
234
234
///
235
235
/// # Compatibility nodes
236
236
///
@@ -240,34 +240,34 @@ pub trait Sink {
240
240
/// this method to what it's always done, just flushing.
241
241
///
242
242
/// In the 0.2 release series of futures this method will be renamed to
243
- /// `poll_flush `. For 0.1, however, the breaking change is not happening
243
+ /// `flush `. For 0.1, however, the breaking change is not happening
244
244
/// yet.
245
- fn poll_complete ( & mut self ) -> Poll < ( ) , Self :: SinkError > ;
245
+ fn flush ( & mut self ) -> Poll < ( ) , Self :: SinkError > ;
246
246
247
247
/// A method to indicate that no more values will ever be pushed into this
248
248
/// sink.
249
249
///
250
250
/// This method is used to indicate that a sink will no longer even be given
251
251
/// another value by the caller. That is, the `start_send` method above will
252
- /// be called no longer (nor `poll_complete `). This method is intended to
252
+ /// be called no longer (nor `flush `). This method is intended to
253
253
/// model "graceful shutdown" in various protocols where the intent to shut
254
254
/// down is followed by a little more blocking work.
255
255
///
256
256
/// Callers of this function should work it it in a similar fashion to
257
- /// `poll_complete `. Once called it may return `Pending` which indicates
257
+ /// `flush `. Once called it may return `Pending` which indicates
258
258
/// that more external work needs to happen to make progress. The current
259
259
/// task will be scheduled to receive a notification in such an event,
260
260
/// however.
261
261
///
262
- /// Note that this function will imply `poll_complete ` above. That is, if a
262
+ /// Note that this function will imply `flush ` above. That is, if a
263
263
/// sink has buffered data, then it'll be flushed out during a `close`
264
- /// operation. It is not necessary to have `poll_complete ` return `Ready`
264
+ /// operation. It is not necessary to have `flush ` return `Ready`
265
265
/// before a `close` is called. Once a `close` is called, though,
266
- /// `poll_complete ` cannot be called.
266
+ /// `flush ` cannot be called.
267
267
///
268
268
/// # Return value
269
269
///
270
- /// This function, like `poll_complete `, returns a `Poll`. The value is
270
+ /// This function, like `flush `, returns a `Poll`. The value is
271
271
/// `Ready` once the close operation has completed. At that point it should
272
272
/// be safe to drop the sink and deallocate associated resources.
273
273
///
@@ -286,7 +286,7 @@ pub trait Sink {
286
286
/// always be true.
287
287
///
288
288
/// Note that it's also typically an error to call `start_send` or
289
- /// `poll_complete ` after the `close` function is called. This method will
289
+ /// `flush ` after the `close` function is called. This method will
290
290
/// *initiate* a close, and continuing to send values after that (or attempt
291
291
/// to flush) may result in strange behavior, panics, errors, etc. Once this
292
292
/// method is called, it must be the only method called on this `Sink`.
@@ -296,12 +296,12 @@ pub trait Sink {
296
296
/// This method may panic or cause panics if:
297
297
///
298
298
/// * It is called outside the context of a future's task
299
- /// * It is called and then `start_send` or `poll_complete ` is called
299
+ /// * It is called and then `start_send` or `flush ` is called
300
300
///
301
301
/// # Compatibility notes
302
302
///
303
303
/// Note that this function is currently by default a provided function,
304
- /// defaulted to calling `poll_complete ` above. This function was added
304
+ /// defaulted to calling `flush ` above. This function was added
305
305
/// in the 0.1 series of the crate as a backwards-compatible addition. It
306
306
/// is intended that in the 0.2 series the method will no longer be a
307
307
/// default method.
@@ -321,8 +321,8 @@ impl<'a, S: ?Sized + Sink> Sink for &'a mut S {
321
321
( * * self ) . start_send ( item)
322
322
}
323
323
324
- fn poll_complete ( & mut self ) -> Poll < ( ) , Self :: SinkError > {
325
- ( * * self ) . poll_complete ( )
324
+ fn flush ( & mut self ) -> Poll < ( ) , Self :: SinkError > {
325
+ ( * * self ) . flush ( )
326
326
}
327
327
328
328
fn close ( & mut self ) -> Poll < ( ) , Self :: SinkError > {
0 commit comments