Navigation Menu

Skip to content

Add some more `EventLoopFuture<Collection>` utilities.

Compare
Choose a tag to compare
@VaporBot VaporBot released this 17 Sep 16:16
· 27 commits to main since this release
535bb30
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 for future.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 accept KeyPaths in place of transformation closures.

If you find yourself trying to articulate your argument against having these additions, you've already missed the point 🙂.