Skip to content

Commit d62c227

Browse files
taiki-ecramertj
authored andcommitted
Fix Ok(Poll) in documentation
1 parent 680b236 commit d62c227

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

futures-channel/src/mpsc/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -548,11 +548,11 @@ impl<T> SenderInner<T> {
548548
///
549549
/// This method returns:
550550
///
551-
/// - `Ok(Poll::Ready(_))` if there is sufficient capacity;
552-
/// - `Ok(Poll::Pending)` if the channel may not have
551+
/// - `Poll::Ready(Ok(_))` if there is sufficient capacity;
552+
/// - `Poll::Pending` if the channel may not have
553553
/// capacity, in which case the current task is queued to be notified once
554554
/// capacity is available;
555-
/// - `Err(SendError)` if the receiver has been dropped.
555+
/// - `Poll::Ready(Err(SendError))` if the receiver has been dropped.
556556
fn poll_ready(
557557
&mut self,
558558
cx: &mut Context<'_>,
@@ -642,11 +642,11 @@ impl<T> Sender<T> {
642642
///
643643
/// This method returns:
644644
///
645-
/// - `Ok(Poll::Ready(_))` if there is sufficient capacity;
646-
/// - `Ok(Poll::Pending)` if the channel may not have
645+
/// - `Poll::Ready(Ok(_))` if there is sufficient capacity;
646+
/// - `Poll::Pending` if the channel may not have
647647
/// capacity, in which case the current task is queued to be notified once
648648
/// capacity is available;
649-
/// - `Err(SendError)` if the receiver has been dropped.
649+
/// - `Poll::Ready(Err(SendError))` if the receiver has been dropped.
650650
pub fn poll_ready(
651651
&mut self,
652652
cx: &mut Context<'_>,

futures-io/src/lib.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ mod if_std {
9696

9797
/// Attempt to read from the `AsyncRead` into `buf`.
9898
///
99-
/// On success, returns `Ok(Poll::Ready(num_bytes_read))`.
99+
/// On success, returns `Poll::Ready(Ok(num_bytes_read))`.
100100
///
101101
/// If no data is available for reading, the method returns
102-
/// `Ok(Poll::Pending)` and arranges for the current task (via
102+
/// `Poll::Pending` and arranges for the current task (via
103103
/// `cx.waker().wake_by_ref()`) to receive a notification when the object becomes
104104
/// readable or is closed.
105105
///
@@ -118,10 +118,10 @@ mod if_std {
118118
/// This method is similar to `poll_read`, but allows data to be read
119119
/// into multiple buffers using a single operation.
120120
///
121-
/// On success, returns `Ok(Poll::Ready(num_bytes_read))`.
121+
/// On success, returns `Poll::Ready(Ok(num_bytes_read))`.
122122
///
123123
/// If no data is available for reading, the method returns
124-
/// `Ok(Poll::Pending)` and arranges for the current task (via
124+
/// `Poll::Pending` and arranges for the current task (via
125125
/// `cx.waker().wake_by_ref()`) to receive a notification when the object becomes
126126
/// readable or is closed.
127127
/// By default, this method delegates to using `poll_read` on the first
@@ -156,10 +156,10 @@ mod if_std {
156156
pub trait AsyncWrite {
157157
/// Attempt to write bytes from `buf` into the object.
158158
///
159-
/// On success, returns `Ok(Poll::Ready(num_bytes_written))`.
159+
/// On success, returns `Poll::Ready(Ok(num_bytes_written))`.
160160
///
161161
/// If the object is not ready for writing, the method returns
162-
/// `Ok(Poll::Pending)` and arranges for the current task (via
162+
/// `Poll::Pending` and arranges for the current task (via
163163
/// `cx.waker().wake_by_ref()`) to receive a notification when the object becomes
164164
/// readable or is closed.
165165
///
@@ -178,10 +178,10 @@ mod if_std {
178178
/// This method is similar to `poll_write`, but allows data from multiple buffers to be written
179179
/// using a single operation.
180180
///
181-
/// On success, returns `Ok(Poll::Ready(num_bytes_written))`.
181+
/// On success, returns `Poll::Ready(Ok(num_bytes_written))`.
182182
///
183183
/// If the object is not ready for writing, the method returns
184-
/// `Ok(Poll::Pending)` and arranges for the current task (via
184+
/// `Poll::Pending` and arranges for the current task (via
185185
/// `cx.waker().wake_by_ref()`) to receive a notification when the object becomes
186186
/// readable or is closed.
187187
///
@@ -209,10 +209,10 @@ mod if_std {
209209
/// Attempt to flush the object, ensuring that any buffered data reach
210210
/// their destination.
211211
///
212-
/// On success, returns `Ok(Poll::Ready(()))`.
212+
/// On success, returns `Poll::Ready(Ok(()))`.
213213
///
214214
/// If flushing cannot immediately complete, this method returns
215-
/// `Ok(Poll::Pending)` and arranges for the current task (via
215+
/// `Poll::Pending` and arranges for the current task (via
216216
/// `cx.waker().wake_by_ref()`) to receive a notification when the object can make
217217
/// progress towards flushing.
218218
///
@@ -226,10 +226,10 @@ mod if_std {
226226

227227
/// Attempt to close the object.
228228
///
229-
/// On success, returns `Ok(Poll::Ready(()))`.
229+
/// On success, returns `Poll::Ready(Ok(()))`.
230230
///
231231
/// If closing cannot immediately complete, this function returns
232-
/// `Ok(Poll::Pending)` and arranges for the current task (via
232+
/// `Poll::Pending` and arranges for the current task (via
233233
/// `cx.waker().wake_by_ref()`) to receive a notification when the object can make
234234
/// progress towards closing.
235235
///

futures-sink/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub trait Sink<Item> {
4848

4949
/// Attempts to prepare the `Sink` to receive a value.
5050
///
51-
/// This method must be called and return `Ok(Poll::Ready(()))` prior to
51+
/// This method must be called and return `Poll::Ready(Ok(()))` prior to
5252
/// each call to `start_send`.
5353
///
5454
/// This method returns `Poll::Ready` once the underlying sink is ready to
@@ -62,7 +62,7 @@ pub trait Sink<Item> {
6262

6363
/// Begin the process of sending a value to the sink.
6464
/// Each call to this function must be proceeded by a successful call to
65-
/// `poll_ready` which returned `Ok(Poll::Ready(()))`.
65+
/// `poll_ready` which returned `Poll::Ready(Ok(()))`.
6666
///
6767
/// As the name suggests, this method only *begins* the process of sending
6868
/// the item. If the sink employs buffering, the item isn't fully processed
@@ -84,11 +84,11 @@ pub trait Sink<Item> {
8484

8585
/// Flush any remaining output from this sink.
8686
///
87-
/// Returns `Ok(Poll::Ready(()))` when no buffered items remain. If this
87+
/// Returns `Poll::Ready(Ok(()))` when no buffered items remain. If this
8888
/// value is returned then it is guaranteed that all previous values sent
8989
/// via `start_send` have been flushed.
9090
///
91-
/// Returns `Ok(Poll::Pending)` if there is more work left to do, in which
91+
/// Returns `Poll::Pending` if there is more work left to do, in which
9292
/// case the current task is scheduled (via `cx.waker().wake_by_ref()`) to wake up when
9393
/// `poll_flush` should be called again.
9494
///
@@ -98,10 +98,10 @@ pub trait Sink<Item> {
9898

9999
/// Flush any remaining output and close this sink, if necessary.
100100
///
101-
/// Returns `Ok(Poll::Ready(()))` when no buffered items remain and the sink
101+
/// Returns `Poll::Ready(Ok(()))` when no buffered items remain and the sink
102102
/// has been successfully closed.
103103
///
104-
/// Returns `Ok(Poll::Pending)` if there is more work left to do, in which
104+
/// Returns `Poll::Pending` if there is more work left to do, in which
105105
/// case the current task is scheduled (via `cx.waker().wake_by_ref()`) to wake up when
106106
/// `poll_close` should be called again.
107107
///

futures-util/src/stream/futures_ordered.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl<Fut: Future> FuturesOrdered<Fut> {
101101
/// Constructs a new, empty `FuturesOrdered`
102102
///
103103
/// The returned `FuturesOrdered` does not contain any futures and, in this
104-
/// state, `FuturesOrdered::poll` will return `Ok(Poll::Ready(None))`.
104+
/// state, `FuturesOrdered::poll_next` will return `Poll::Ready(None)`.
105105
pub fn new() -> FuturesOrdered<Fut> {
106106
FuturesOrdered {
107107
in_progress_queue: FuturesUnordered::new(),

futures-util/src/stream/unfold.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ use pin_utils::{unsafe_pinned, unsafe_unpinned};
1515
/// value `a`, and use `b` as the next internal state.
1616
///
1717
/// If the closure returns `None` instead of `Some(Future)`, then the `unfold()`
18-
/// will stop producing items and return `Ok(Poll::Ready(None))` in future
18+
/// will stop producing items and return `Poll::Ready(None)` in future
1919
/// calls to `poll()`.
2020
///
2121
/// In case of error generated by the returned `Future`, the error will be
2222
/// returned by the `Stream`. The `Stream` will then yield
23-
/// `Ok(Poll::Ready(None))` in future calls to `poll()`.
23+
/// `Poll::Ready(None)` in future calls to `poll()`.
2424
///
2525
/// This function can typically be used when wanting to go from the "world of
2626
/// futures" to the "world of streams": the provided closure can build a

0 commit comments

Comments
 (0)