mirror of
https://github.com/apple/swift-nio
synced 2026-11-27 05:04:22 +00:00
standardize ELF.cascade* collection of methods (#802)
Motivation: The `ELF.cascade` methods have a parameter label `promise` that does not match Swift API Guidelines, and a way to cascade just successes is not available - while for failures there is. Modifications: `ELF.cascade*` methods that already exist have had their `promise` label renamed to `to`, and a new `ELF.cascadeSuccess` method has been added. Result: EventLoopFuture now has the cascade methods `ELF.cascade(to:)`, `ELF.cascadeFailure(to:)`, and `ELF.cascadeSuccess(to:)`
This commit is contained in:
1 parent
9b9dcebecf
commit
caf9a3d8da
18 files changed
+70
-47
No files matched your search
@@ -21,7 +21,7 @@ private func writeChunk(wrapOutboundOut: (IOData) -> NIOAny, ctx: ChannelHandler
|
||||
case (true, .some(let p)):
|
||||
/* chunked encoding and the user's interested: we need three promises and need to cascade into the users promise */
|
||||
let (w1, w2, w3) = (ctx.eventLoop.makePromise() as EventLoopPromise<Void>, ctx.eventLoop.makePromise() as EventLoopPromise<Void>, ctx.eventLoop.makePromise() as EventLoopPromise<Void>)
|
||||
w1.futureResult.and(w2.futureResult).and(w3.futureResult).map { (_: ((((), ()), ()))) in }.cascade(promise: p)
|
||||
w1.futureResult.and(w2.futureResult).and(w3.futureResult).map { (_: ((((), ()), ()))) in }.cascade(to: p)
|
||||
(mW1, mW2, mW3) = (w1, w2, w3)
|
||||
case (false, .some(let p)):
|
||||
/* not chunked, so just use the user's promise for the actual data */
|
||||
|
||||
Reference in new issue
Block a user