Add some more `EventLoopFuture<Collection>` utilities.
This patch was authored and released by @gwynne.
I have to admit, everyone - this one's just a little bit for fun. But with Swift 5.5 and its concurrency magic around the corner, why not?! 😀
Changes:
- Add
EventLoopFuture.mapEachFlat(_:)
, shorthand forfuture.map { $0.flatMap(...) }
. Complements.mapEach(_:)
and.mapEachCompact(_:)
. Per the existing naming "convention", this is the "map a sequence of sequences to a sequence" utility, and.flatMapEach(_:)
is the "map a sequence to a sequence of futures" utility. It's not confusing at all! Totally!! - Add variants of
.mapEach(_:)
,.mapEachCompact(_:)
, and.mapEachFlat(_:)
which acceptKeyPath
s in place of transformation closures.
If you find yourself trying to articulate your argument against having these additions, you've already missed the point 🙂.