unwrap(orReplace:)

Unwrap an EventLoopFuture where its type parameter is an Optional.

EventLoopFuture+AssumeIsolated.swift:547
func unwrap<NewValue>(orReplace replacement: NewValue) -> EventLoopFuture<NewValue>.Isolated where Value == NewValue?

Parameters

replacement

the value of the returned EventLoopFuture when then resolved future’s value is Optional.some().

Returns

an new EventLoopFuture with new type parameter NewValue and the value passed in the orReplace parameter.

Unwraps a future returning a new EventLoopFuture with either: the value passed in the orReplace parameter when the future resolved with value Optional.none, or the same value otherwise. For example:

promise.futureResult.unwrap(orReplace: 42).wait()