summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-06-15 01:16:04 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-06-15 01:16:26 +0200
commitad2e4c535af01453777e330aa828db6988f9c4de (patch)
treea717b10f2f93033ca8d4c9fdeb716a26820d05ac /runtime
parent43033c7f83b13838803bc82a7bbef654a8071892 (diff)
downloadiced-ad2e4c535af01453777e330aa828db6988f9c4de.tar.gz
iced-ad2e4c535af01453777e330aa828db6988f9c4de.tar.bz2
iced-ad2e4c535af01453777e330aa828db6988f9c4de.zip
Fix `Task::collect` not producing the collected outputs
Diffstat (limited to 'runtime')
-rw-r--r--runtime/src/task.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/runtime/src/task.rs b/runtime/src/task.rs
index 51cdf5a8..740360ac 100644
--- a/runtime/src/task.rs
+++ b/runtime/src/task.rs
@@ -208,18 +208,25 @@ impl<T> Task<T> {
None => Task::done(Vec::new()),
Some(stream) => Task(Some(boxed_stream(
stream::unfold(
- (stream, Vec::new()),
- |(mut stream, mut outputs)| async move {
- let action = stream.next().await?;
+ (stream, Some(Vec::new())),
+ move |(mut stream, outputs)| async move {
+ let mut outputs = outputs?;
+
+ let Some(action) = stream.next().await else {
+ return Some((
+ Some(Action::Output(outputs)),
+ (stream, None),
+ ));
+ };
match action.output() {
Ok(output) => {
outputs.push(output);
- Some((None, (stream, outputs)))
+ Some((None, (stream, Some(outputs))))
}
Err(action) => {
- Some((Some(action), (stream, outputs)))
+ Some((Some(action), (stream, Some(outputs))))
}
}
},