Skip to content

Instance Method

flatMapAlways(file:line:_:)

When the current EventLoopFuture receives any result, run the provided callback, which will provide a new EventLoopFuture. Essentially combines the behaviors of .always(_:) and .flatMap(file:line:_:).
func flatMapAlways<NewValue>(file: StaticString = #file, line: UInt = #line, _ callback: @escaping (Result<Value, any Error>) -> EventLoopFuture<NewValue>) -> EventLoopFuture<NewValue>

Discussion

This is useful when some work must be done for both success and failure states, especially work that requires temporarily extending the lifetime of one or more objects.

See Also

EventLoopFuture