diff --git a/src/stream/successors.rs b/src/stream/successors.rs index 0295b33..f7d5bd8 100644 --- a/src/stream/successors.rs +++ b/src/stream/successors.rs @@ -7,33 +7,10 @@ use crate::task::{Context, Poll, ready}; use pin_project_lite::pin_project; - - -pin_project! { - /// A stream that yields elements by calling an async closure with the previous value as an - /// argument - /// - /// This stream is constructed by [`successors`] function - /// - /// [`succcessors`]: fn.succssors.html - #[cfg(feature = "unstable")] - #[cfg_attr(feature = "docs", doc(cfg(unstable)))] - #[derive(Debug)] - pub struct Successors - where - Fut: Future>, - { - succ: F, - #[pin] - future: Option, - slot: Option, - } -} - /// Creates a new stream where to produce each new element a closure is called with the previous /// value. /// -/// #Examples +/// # Examples /// /// ``` /// # fn main() { async_std::task::block_on(async { @@ -82,6 +59,27 @@ where } } +pin_project! { + /// A stream that yields elements by calling an async closure with the previous value as an + /// argument + /// + /// This stream is constructed by [`successors`] function + /// + /// [`successors`]: fn.succssors.html + #[cfg(feature = "unstable")] + #[cfg_attr(feature = "docs", doc(cfg(unstable)))] + #[derive(Debug)] + pub struct Successors + where + Fut: Future>, + { + succ: F, + #[pin] + future: Option, + slot: Option, + } +} + impl Stream for Successors where Fut: Future>,