Slight renamings

new-scheduler
Felipe Sere 5 years ago
parent 8b662b659d
commit 554d5cfbc1

@ -12,7 +12,7 @@ use crate::task::{Context, Poll};
/// ///
/// [`successor`]: fn.successor.html /// [`successor`]: fn.successor.html
#[derive(Debug)] #[derive(Debug)]
pub struct Successor<F, Fut, T> pub struct Successors<F, Fut, T>
where where
Fut: Future<Output = T>, Fut: Future<Output = T>,
{ {
@ -22,7 +22,7 @@ where
_marker: PhantomData<Fut>, _marker: PhantomData<Fut>,
} }
/// Creates a new stream where to produce each new element a clousre is called with the previous /// Creates a new stream where to produce each new element a closure is called with the previous
/// value. /// value.
/// ///
/// #Examples /// #Examples
@ -33,7 +33,7 @@ where
/// use async_std::prelude::*; /// use async_std::prelude::*;
/// use async_std::stream; /// use async_std::stream;
/// ///
/// let s = stream::successor(22, |val| { /// let s = stream::successors(22, |val| {
/// async move { /// async move {
/// val + 1 /// val + 1
/// } /// }
@ -47,13 +47,13 @@ where
/// # }) } /// # }) }
/// ///
/// ``` /// ```
pub fn successor<F, Fut, T>(start: T, func: F) -> Successor<F, Fut, T> pub fn successors<F, Fut, T>(start: T, func: F) -> Successors<F, Fut, T>
where where
F: FnMut(T) -> Fut, F: FnMut(T) -> Fut,
Fut: Future<Output = T>, Fut: Future<Output = T>,
T: Copy, T: Copy,
{ {
Successor { Successors {
successor: func, successor: func,
future: None, future: None,
next: start, next: start,
@ -61,7 +61,7 @@ where
} }
} }
impl<F, Fut, T> Successor<F, Fut, T> impl<F, Fut, T> Successors<F, Fut, T>
where where
F: FnMut(T) -> Fut, F: FnMut(T) -> Fut,
Fut: Future<Output = T>, Fut: Future<Output = T>,
@ -72,7 +72,7 @@ where
pin_utils::unsafe_pinned!(future: Option<Fut>); pin_utils::unsafe_pinned!(future: Option<Fut>);
} }
impl<F, Fut, T> Stream for Successor<F, Fut, T> impl<F, Fut, T> Stream for Successors<F, Fut, T>
where where
Fut: Future<Output = T>, Fut: Future<Output = T>,
F: FnMut(T) -> Fut, F: FnMut(T) -> Fut,

Loading…
Cancel
Save