Skip to content

Commit e6d44f6

Browse files
committed
Documented futures crate.
1 parent a28ceaa commit e6d44f6

File tree

5 files changed

+14
-2
lines changed

5 files changed

+14
-2
lines changed

swimos_utilities/swimos_future/src/combinators/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ impl<Str: TryStream> Stream for StopAfterError<Str> {
6666
}
6767
}
6868

69+
/// A future that will trigger a notification whenever the future it wraps returns [`Poll::Pending`].
6970
#[pin_project]
7071
pub struct NotifyOnBlocked<F> {
7172
#[pin]
@@ -74,6 +75,9 @@ pub struct NotifyOnBlocked<F> {
7475
}
7576

7677
impl<F> NotifyOnBlocked<F> {
78+
/// # Arguments
79+
/// * `inner` - The future to wrap.
80+
/// * `notify`- This will be notified whenever the wrapped future returns [`Poll::Pending`].
7781
pub fn new(inner: F, notify: Arc<Notify>) -> NotifyOnBlocked<F> {
7882
NotifyOnBlocked { inner, notify }
7983
}

swimos_utilities/swimos_future/src/combinators/race/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use std::future::Future;
77
use std::pin::Pin;
88
use std::task::{Context, Poll};
99

10+
/// The type returned by the [`race`] function.
1011
#[must_use = "futures do nothing unless you `.await` or poll them"]
1112
#[derive(Debug)]
1213
pub struct Race2<L, R> {

swimos_utilities/swimos_future/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
//! Futures Combinators
16+
//!
17+
//! Additional combinators for [`std::future::Future`]s that express transformations that are not
18+
//! available in the [`futures`] crate.
19+
1520
mod combinators;
1621
mod retry_strategy;
1722
mod union;

swimos_utilities/swimos_future/src/retry_strategy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ const DEFAULT_IMMEDIATE_RETRIES: NonZeroUsize = non_zero_usize!(16);
2323
const DEFAULT_INTERVAL_RETRIES: NonZeroUsize = non_zero_usize!(8);
2424
const DEFAULT_INTERVAL_DELAY: u64 = 10;
2525

26-
/// The retry strategy that a ['RetryableRequest`] uses to determine when to perform the next
27-
/// request.
26+
/// A strategy that determines how many times, and at what interval, a fallible process should be
27+
/// attempted.
2828
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
2929
pub enum RetryStrategy {
3030
/// A retry with a defined delay in between the requests.

swimos_utilities/swimos_future/src/union/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use std::{
2020
use futures::Future;
2121
use pin_project::pin_project;
2222

23+
/// Runs any one of three possible types of future, all of which produce the same output type.
2324
#[derive(Debug, Clone, Copy)]
2425
#[pin_project(project = Union3Proj)]
2526
pub enum UnionFuture3<F1, F2, F3> {
@@ -28,6 +29,7 @@ pub enum UnionFuture3<F1, F2, F3> {
2829
Third(#[pin] F3),
2930
}
3031

32+
/// Runs any one of four possible types of future, all of which produce the same output type.
3133
#[derive(Debug, Clone, Copy)]
3234
#[pin_project(project = Union4Proj)]
3335
pub enum UnionFuture4<F1, F2, F3, F4> {

0 commit comments

Comments
 (0)