diff options
| author | 2024-07-10 14:24:52 +0200 | |
|---|---|---|
| committer | 2024-07-10 14:24:52 +0200 | |
| commit | 8efe161e3d08b56cba8db1320b8433efa45fa79e (patch) | |
| tree | fcd5ed68c3fbdbb3d49b60b4c3de8a97ea2dffc2 /runtime | |
| parent | e86920be5b9984b4eb511e5e69efdcbf6ef3d8e4 (diff) | |
| download | iced-8efe161e3d08b56cba8db1320b8433efa45fa79e.tar.gz iced-8efe161e3d08b56cba8db1320b8433efa45fa79e.tar.bz2 iced-8efe161e3d08b56cba8db1320b8433efa45fa79e.zip  | |
Move docs of `future` and `stream` in `Task`
Diffstat (limited to 'runtime')
| -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>> {  | 
