File tree 1 file changed +9
-4
lines changed
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -350,17 +350,22 @@ as there are many more open questions around them than around just a simpler way
350
350
351
351
## ` async ` interactions
352
352
353
- We could support using ` await ` in ` gen ` blocks, similar to how we support ` ? ` being used within them.
354
- This is not trivially possible due to the fact that ` Iterator::next ` takes ` &mut self ` and not ` Pin<&mut self> ` .
353
+ We could support using ` await ` in ` async gen ` blocks, similar to how we support ` ? ` being used within ` gen ` blocks.
354
+ This is not possible in general due to the fact that ` Iterator::next ` takes ` &mut self ` and not ` Pin<&mut self> ` , but
355
+ it should be possible if no references are held across the ` await ` point, similar to how we disallow holding
356
+ references across ` yield ` points in this RFC.
355
357
356
- There are a few options forward for this:
358
+
359
+ ## self-referential ` gen ` bloocks
360
+
361
+ There are a few options forward:
357
362
358
363
* Add a separate trait for pinned iteration that is also usable with ` gen ` and ` for `
359
364
* downside: very similar traits for the same thing
360
365
* backwards compatibly add a way to change the argument type of ` Iterator::next `
361
366
* downside: unclear if possible
362
367
* implement ` Iterator ` for ` Pin<&mut G> ` instead of for ` G ` directly (whatever ` G ` is here, but it could be a ` gen ` block)
363
- * downside: the thing being iterated over must now be pinned for the entire iteration, instead of for each iteration
368
+ * downside: the thing being iterated over must now be pinned for the entire iteration, instead of for each invocation of ` next ` .
364
369
365
370
## ` try ` interactions
366
371
You can’t perform that action at this time.
0 commit comments