diff options
-rw-r--r-- | runtime/src/task.rs | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/runtime/src/task.rs b/runtime/src/task.rs index e037c403..d1864473 100644 --- a/runtime/src/task.rs +++ b/runtime/src/task.rs @@ -55,24 +55,6 @@ impl<T> Task<T> { Self::stream(stream.map(f)) } - /// Creates a new [`Task`] that runs the given [`Future`] and produces - /// its output. - pub fn future(future: impl Future<Output = T> + MaybeSend + 'static) -> Self - where - T: 'static, - { - Self::stream(stream::once(future)) - } - - /// Creates a new [`Task`] that runs the given [`Stream`] and produces - /// each of its items. - pub fn stream(stream: impl Stream<Item = T> + MaybeSend + 'static) -> Self - where - T: 'static, - { - Self(Some(boxed_stream(stream.map(Action::Output)))) - } - /// Combines the given tasks and produces a single [`Task`] that will run all of them /// in parallel. pub fn batch(tasks: impl IntoIterator<Item = Self>) -> Self @@ -176,6 +158,24 @@ impl<T> Task<T> { ))), } } + + /// Creates a new [`Task`] that runs the given [`Future`] and produces + /// its output. + pub fn future(future: impl Future<Output = T> + MaybeSend + 'static) -> Self + where + T: 'static, + { + Self::stream(stream::once(future)) + } + + /// Creates a new [`Task`] that runs the given [`Stream`] and produces + /// each of its items. + pub fn stream(stream: impl Stream<Item = T> + MaybeSend + 'static) -> Self + where + T: 'static, + { + Self(Some(boxed_stream(stream.map(Action::Output)))) + } } impl<T> Task<Option<T>> { |