Skip to content

Commit b15af51

Browse files
committed
Unify the style of combinator type descriptions
1 parent 8735d40 commit b15af51

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+95
-317
lines changed

futures-util/src/future/catch_unwind.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ use std::pin::Pin;
66
use std::panic::{catch_unwind, UnwindSafe, AssertUnwindSafe};
77
use std::prelude::v1::*;
88

9-
/// Future for the `catch_unwind` combinator.
10-
///
11-
/// This is created by the `Future::catch_unwind` method.
9+
/// Future for the [`catch_unwind`](super::FutureExt::catch_unwind) combinator.
1210
#[derive(Debug)]
1311
#[must_use = "futures do nothing unless polled"]
1412
pub struct CatchUnwind<Fut> where Fut: Future {

futures-util/src/future/disabled/select.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@ use futures_core::task;
33

44
use either::Either;
55

6-
/// Future for the `select` combinator, waiting for one of two differently-typed
7-
/// futures to complete.
8-
///
9-
/// This is created by the [`Future::select`] method.
10-
///
11-
/// [`Future::select`]: trait.Future.html#method.select
6+
/// Future for the [`select`](super::FutureExt::select) combinator.
127
#[must_use = "futures do nothing unless polled"]
138
#[derive(Debug)]
149
pub struct Select<A, B> {

futures-util/src/future/disabled/select_all.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ use std::prelude::v1::*;
77
use futures_core::{Future, IntoFuture, Poll, Async};
88
use futures_core::task;
99

10-
/// Future for the `select_all` combinator, waiting for one of any of a list of
11-
/// futures to complete.
12-
///
13-
/// This is created by the `select_all` function.
10+
/// Future for the [`select_all`] combinator.
1411
#[derive(Debug)]
1512
#[must_use = "futures do nothing unless polled"]
1613
pub struct SelectAll<A> where A: Future {

futures-util/src/future/disabled/select_ok.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@ use std::prelude::v1::*;
77
use futures_core::{Future, IntoFuture, Poll, Async};
88
use futures_core::task;
99

10-
/// Future for the `select_ok` combinator, waiting for one of any of a list of
11-
/// futures to successfully complete. Unlike `select_all`, this future ignores all
12-
/// but the last error, if there are any.
13-
///
14-
/// This is created by the `select_ok` function.
10+
/// Future for the [`select_ok`] combinator.
1511
#[derive(Debug)]
1612
#[must_use = "futures do nothing unless polled"]
1713
pub struct SelectOk<A> where A: Future {

futures-util/src/future/empty.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ use core::pin::Pin;
33
use futures_core::future::{Future, FusedFuture};
44
use futures_core::task::{Waker, Poll};
55

6-
/// A future which is never resolved.
7-
///
8-
/// This future can be created with the [`empty()`] function.
6+
/// Future for the [`empty`] combinator.
97
#[derive(Debug)]
108
#[must_use = "futures do nothing unless polled"]
119
pub struct Empty<T> {

futures-util/src/future/flatten.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ use futures_core::future::{FusedFuture, Future};
55
use futures_core::task::{Waker, Poll};
66
use pin_utils::unsafe_pinned;
77

8-
/// Future for the `flatten` combinator.
9-
///
10-
/// This combinator turns a `Future`-of-a-`Future` into a single `Future`.
11-
///
12-
/// This is created by the `Future::flatten` method.
8+
/// Future for the [`flatten`](super::FutureExt::flatten) combinator.
139
#[must_use = "futures do nothing unless polled"]
1410
pub struct Flatten<Fut>
1511
where Fut: Future,

futures-util/src/future/flatten_stream.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ use futures_core::future::Future;
44
use futures_core::stream::{FusedStream, Stream};
55
use futures_core::task::{Waker, Poll};
66

7-
/// Future for the `flatten_stream` combinator, flattening a
8-
/// future-of-a-stream to get just the result of the final stream as a stream.
9-
///
10-
/// This is created by the `Future::flatten_stream` method.
7+
/// Stream for the [`flatten_stream`](super::FutureExt::flatten_stream)
8+
/// combinator.
119
#[must_use = "streams do nothing unless polled"]
1210
pub struct FlattenStream<Fut: Future> {
1311
state: State<Fut>

futures-util/src/future/fuse.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,7 @@ use futures_core::future::{Future, FusedFuture};
33
use futures_core::task::{Waker, Poll};
44
use pin_utils::unsafe_pinned;
55

6-
/// A future which "fuses" a future once it has been resolved.
7-
/// This wrapper can be used to turn any `Future` into a `FusedFuture`.
8-
///
9-
/// Normally, `poll`ing a future after it has completed (returned `Poll::Ready`
10-
/// from a call to `poll`) can cause arbitrary behavior (panics, deadlock).
11-
/// `Fuse` is always defined to return `Poll::Pending` from `poll` after it has
12-
/// resolved.
13-
///
14-
/// This is created by the `Future::fuse` method.
6+
/// Future for the [`fuse`](super::FutureExt::fuse) combinator.
157
#[derive(Debug)]
168
#[must_use = "futures do nothing unless polled"]
179
pub struct Fuse<Fut: Future> {

futures-util/src/future/inspect.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ use futures_core::future::{FusedFuture, Future};
33
use futures_core::task::{Waker, Poll};
44
use pin_utils::{unsafe_pinned, unsafe_unpinned};
55

6-
/// Do something with the item of a future, passing it on.
7-
///
8-
/// This is created by the [`super::FutureExt::inspect`] method.
6+
/// Future for the [`inspect`](super::FutureExt::inspect) combinator.
97
#[derive(Debug)]
108
#[must_use = "futures do nothing unless polled"]
119
pub struct Inspect<Fut, F> where Fut: Future {

futures-util/src/future/into_stream.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ use futures_core::stream::Stream;
44
use futures_core::task::{Waker, Poll};
55
use pin_utils::unsafe_pinned;
66

7-
/// A type which converts a `Future` into a `Stream`
8-
/// containing a single element.
7+
/// Stream for the [`into_stream`](super::FutureExt::into_stream) combinator.
98
#[must_use = "futures do nothing unless polled"]
109
#[derive(Debug)]
1110
pub struct IntoStream<Fut: Future> {

futures-util/src/future/join.rs

+4-16
Original file line numberDiff line numberDiff line change
@@ -68,27 +68,15 @@ macro_rules! generate {
6868
}
6969

7070
generate! {
71-
/// Future for the `join` combinator, waiting for two futures to
72-
/// complete.
73-
///
74-
/// This is created by the `Future::join` method.
71+
/// Future for the [`join`](super::FutureExt::join) combinator.
7572
(Join, <Fut1, Fut2>),
7673

77-
/// Future for the `join3` combinator, waiting for three futures to
78-
/// complete.
79-
///
80-
/// This is created by the `Future::join3` method.
74+
/// Future for the [`join3`](super::FutureExt::join3) combinator.
8175
(Join3, <Fut1, Fut2, Fut3>),
8276

83-
/// Future for the `join4` combinator, waiting for four futures to
84-
/// complete.
85-
///
86-
/// This is created by the `Future::join4` method.
77+
/// Future for the [`join4`](super::FutureExt::join4) combinator.
8778
(Join4, <Fut1, Fut2, Fut3, Fut4>),
8879

89-
/// Future for the `join5` combinator, waiting for five futures to
90-
/// complete.
91-
///
92-
/// This is created by the `Future::join5` method.
80+
/// Future for the [`join5`](super::FutureExt::join5) combinator.
9381
(Join5, <Fut1, Fut2, Fut3, Fut4, Fut5>),
9482
}

futures-util/src/future/join_all.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ fn iter_pin_mut<T>(slice: Pin<&mut [T]>) -> impl Iterator<Item = Pin<&mut T>> {
5555
.map(|t| unsafe { Pin::new_unchecked(t) })
5656
}
5757

58-
/// A future which takes a list of futures and resolves with a vector of the
59-
/// completed values.
60-
///
61-
/// This future is created with the `join_all` function.
58+
/// Future for the [`join_all`] combinator.
6259
#[must_use = "futures do nothing unless polled"]
6360
pub struct JoinAll<F>
6461
where

futures-util/src/future/lazy.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ use core::pin::Pin;
22
use futures_core::future::{FusedFuture, Future};
33
use futures_core::task::{Waker, Poll};
44

5-
/// A future which, when polled, invokes a closure and yields its result.
6-
///
7-
/// This is created by the [`lazy()`] function.
5+
/// Future for the [`lazy`] combinator.
86
#[derive(Debug)]
97
#[must_use = "futures do nothing unless polled"]
108
pub struct Lazy<F> {

futures-util/src/future/map.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ use futures_core::future::{FusedFuture, Future};
33
use futures_core::task::{Waker, Poll};
44
use pin_utils::{unsafe_pinned, unsafe_unpinned};
55

6-
/// Future for the `map` combinator, changing the type of a future.
7-
///
8-
/// This is created by the `Future::map` method.
6+
/// Future for the [`map`](super::FutureExt::map) combinator.
97
#[derive(Debug)]
108
#[must_use = "futures do nothing unless polled"]
119
pub struct Map<Fut, F> {

futures-util/src/future/poll_fn.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ use core::pin::Pin;
44
use futures_core::future::Future;
55
use futures_core::task::{Waker, Poll};
66

7-
/// A future which wraps a function returning [`Poll`].
8-
///
9-
/// Created by the [`poll_fn()`] function.
7+
/// Future for the [`poll_fn`] combinator.
108
#[derive(Debug)]
119
#[must_use = "futures do nothing unless polled"]
1210
pub struct PollFn<F> {

futures-util/src/future/ready.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ use core::pin::Pin;
22
use futures_core::future::{FusedFuture, Future};
33
use futures_core::task::{Waker, Poll};
44

5-
/// A future that is immediately ready with a value
6-
///
7-
/// Created by the [`ready()`] function.
5+
/// Future for the [`ready`](ready()) combinator.
86
#[derive(Debug, Clone)]
97
#[must_use = "futures do nothing unless polled"]
108
pub struct Ready<T>(Option<T>);

futures-util/src/future/shared.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ use std::sync::atomic::AtomicUsize;
99
use std::sync::atomic::Ordering::SeqCst;
1010
use std::sync::{Arc, Mutex};
1111

12-
/// A future that is cloneable and can be polled in multiple threads.
13-
/// Use the [`shared`](crate::FutureExt::shared) combinator method to convert
14-
/// any future into a `Shared` future.
12+
/// Future for the [`shared`](super::FutureExt::shared) combinator.
1513
#[must_use = "futures do nothing unless polled"]
1614
pub struct Shared<Fut: Future> {
1715
inner: Option<Arc<Inner<Fut>>>,

futures-util/src/future/then.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ use futures_core::future::{FusedFuture, Future};
44
use futures_core::task::{Waker, Poll};
55
use pin_utils::unsafe_pinned;
66

7-
/// Future for the `then` combinator, chaining computations on the end of
8-
/// another future regardless of its outcome.
9-
///
10-
/// This is created by the `Future::then` method.
7+
/// Future for the [`then`](super::FutureExt::then) combinator.
118
#[derive(Debug)]
129
#[must_use = "futures do nothing unless polled"]
1310
pub struct Then<Fut1, Fut2, F> {

futures-util/src/io/close.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ use futures_io::AsyncWrite;
44
use std::io;
55
use std::pin::Pin;
66

7-
/// A future used to fully close an I/O object.
8-
///
9-
/// Created by the [`close`] function.
10-
///
11-
/// [`close`]: fn.close.html
7+
/// Future for the [`close`](super::AsyncWriteExt::close) combinator.
128
#[derive(Debug)]
139
pub struct Close<'a, W: ?Sized + Unpin> {
1410
writer: &'a mut W,

futures-util/src/io/copy_into.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,7 @@ use std::boxed::Box;
55
use std::io;
66
use std::pin::Pin;
77

8-
/// A future which will copy all data from a reader into a writer.
9-
///
10-
/// Created by the [`copy_into`] function, this future will resolve to the number of
11-
/// bytes copied or an error if one happens.
12-
///
13-
/// [`copy_into`]: fn.copy_into.html
8+
/// Future for the [`copy_into`](super::AsyncReadExt::copy_into) combinator.
149
#[derive(Debug)]
1510
pub struct CopyInto<'a, R: ?Sized + Unpin, W: ?Sized + Unpin> {
1611
reader: &'a mut R,

futures-util/src/io/flush.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,7 @@ use futures_io::AsyncWrite;
44
use std::io;
55
use std::pin::Pin;
66

7-
/// A future used to fully flush an I/O object.
8-
///
9-
/// Resolves to the underlying I/O object once the flush operation is complete.
10-
///
11-
/// Created by the [`flush`] function.
12-
///
13-
/// [`flush`]: fn.flush.html
7+
/// Future for the [`flush`](super::AsyncWriteExt::flush) combinator.
148
#[derive(Debug)]
159
pub struct Flush<'a, W: ?Sized + Unpin> {
1610
writer: &'a mut W,

futures-util/src/io/read.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ use futures_core::task::{Waker, Poll};
44
use std::io;
55
use std::pin::Pin;
66

7-
/// A future which can be used to easily read available number of bytes to fill
8-
/// a buffer.
7+
/// Future for the [`read`](super::AsyncReadExt::read) combinator.
98
#[derive(Debug)]
109
pub struct Read<'a, R: ?Sized + Unpin> {
1110
reader: &'a mut R,

futures-util/src/io/read_exact.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,7 @@ use std::io;
55
use std::mem;
66
use std::pin::Pin;
77

8-
/// A future which can be used to easily read exactly enough bytes to fill
9-
/// a buffer.
10-
///
11-
/// Created by the [`read_exact`] function.
12-
///
13-
/// [`read_exact`]: fn.read_exact.html
8+
/// Future for the [`read_exact`](super::AsyncReadExt::read_exact) combinator.
149
#[derive(Debug)]
1510
pub struct ReadExact<'a, R: ?Sized + Unpin> {
1611
reader: &'a mut R,

futures-util/src/io/read_to_end.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,7 @@ use std::io;
55
use std::pin::Pin;
66
use std::vec::Vec;
77

8-
/// A future which can be used to easily read the entire contents of a stream
9-
/// into a vector.
10-
///
11-
/// Created by the [`read_to_end`] function.
12-
///
13-
/// [`read_to_end`]: fn.read_to_end.html
8+
/// Future for the [`read_to_end`](super::AsyncReadExt::read_to_end) combinator.
149
#[derive(Debug)]
1510
pub struct ReadToEnd<'a, R: ?Sized + Unpin> {
1611
reader: &'a mut R,

futures-util/src/io/write_all.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ use std::io;
55
use std::mem;
66
use std::pin::Pin;
77

8-
/// A future used to write the entire contents of some data to a stream.
9-
///
10-
/// This is created by the [`write_all`] top-level method.
11-
///
12-
/// [`write_all`]: fn.write_all.html
8+
/// Future for the [`write_all`](super::AsyncWriteExt::write_all) combinator.
139
#[derive(Debug)]
1410
pub struct WriteAll<'a, W: ?Sized + Unpin> {
1511
writer: &'a mut W,

futures-util/src/sink/buffer.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ use pin_utils::{unsafe_pinned, unsafe_unpinned};
55
use core::pin::Pin;
66
use alloc::collections::VecDeque;
77

8-
/// Sink for the `Sink::buffer` combinator, which buffers up to some fixed
9-
/// number of values when the underlying sink is unable to accept them.
8+
/// Sink for the [`buffer`](super::SinkExt::buffer) combinator.
109
#[derive(Debug)]
1110
#[must_use = "sinks do nothing unless polled"]
1211
pub struct Buffer<Si: Sink<Item>, Item> {

futures-util/src/sink/close.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ use futures_core::future::Future;
44
use futures_core::task::{Waker, Poll};
55
use futures_sink::Sink;
66

7-
/// Future for the `close` combinator, which polls the sink until all data has
8-
/// been closed.
7+
/// Future for the [`close`](super::SinkExt::close) combinator.
98
#[derive(Debug)]
109
#[must_use = "futures do nothing unless polled"]
1110
pub struct Close<'a, Si: Sink<Item> + Unpin + ?Sized, Item> {

futures-util/src/sink/drain.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ use core::pin::Pin;
44
use futures_core::task::{Waker, Poll};
55
use futures_sink::Sink;
66

7-
/// A sink that will discard all items given to it.
8-
///
9-
/// See the [`drain()`] function for more details.
7+
/// Sink for the [`drain`] combinator.
108
#[derive(Debug)]
119
#[must_use = "futures do nothing unless polled"]
1210
pub struct Drain<T> {

futures-util/src/sink/err_into.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ use futures_core::task::{Waker, Poll};
55
use futures_sink::{Sink};
66
use pin_utils::unsafe_pinned;
77

8-
/// A sink combinator to change the error type of a sink.
9-
///
10-
/// This is created by the `Sink::err_into` method.
8+
/// Sink for the [`sink_err_into`](super::SinkExt::sink_err_into) combinator.
119
#[derive(Debug)]
1210
#[must_use = "futures do nothing unless polled"]
1311
pub struct SinkErrInto<Si: Sink<Item>, Item, E> {

futures-util/src/sink/flush.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ use futures_core::future::Future;
44
use futures_core::task::{Waker, Poll};
55
use futures_sink::Sink;
66

7-
/// Future for the `flush` combinator, which polls the sink until all data
8-
/// has been flushed.
7+
/// Future for the [`flush`](super::SinkExt::flush) combinator.
98
#[derive(Debug)]
109
#[must_use = "futures do nothing unless polled"]
1110
pub struct Flush<'a, Si: Sink<Item> + Unpin + ?Sized, Item> {

futures-util/src/sink/map_err.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use futures_core::task::{Waker, Poll};
44
use futures_sink::{Sink};
55
use pin_utils::{unsafe_pinned, unsafe_unpinned};
66

7-
/// Sink for the `Sink::sink_map_err` combinator.
7+
/// Sink for the [`sink_map_err`](super::SinkExt::sink_map_err) combinator.
88
#[derive(Debug)]
99
#[must_use = "sinks do nothing unless polled"]
1010
pub struct SinkMapErr<Si, F> {

futures-util/src/sink/send.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ use futures_core::future::Future;
33
use futures_core::task::{Waker, Poll};
44
use futures_sink::Sink;
55

6-
/// Future for the `Sink::send` combinator, which sends a value to a sink and
7-
/// then waits until the sink has fully flushed.
6+
/// Future for the [`send`](super::SinkExt::send) combinator.
87
#[derive(Debug)]
98
#[must_use = "futures do nothing unless polled"]
109
pub struct Send<'a, Si: Sink<Item> + Unpin + ?Sized, Item> {

0 commit comments

Comments
 (0)