cascadeSuccess(to:)

Fulfills the given EventLoopPromise only when this EventLoopFuture succeeds.

EventLoopFuture.swift:1025
@preconcurrency func cascadeSuccess(to promise: EventLoopPromise<Value>?) where Value : Sendable

Parameters

promise

The EventLoopPromise to fulfill when a successful result is available.

If you are doing work that fulfills a type that doesn’t match the expected EventLoopPromise value, add an intermediate map.

For example:

let boolPromise = eventLoop.makePromise(of: Bool.self)
doWorkReturningInt().map({ $0 >= 0 }).cascade(to: boolPromise)