Generic Instance Method

flatMap(_:)

Returns a new result, mapping any success value using the given transformation and unwrapping the produced result.

Declaration

func flatMap<NewSuccess>(_ transform: (Success) -> Result<NewSuccess, Failure>) -> Result<NewSuccess, Failure>

Parameters

transform

A closure that takes the success value of the instance.

Return Value

A Result instance with the result of evaluating transform as the new failure value if this instance represents a failure.

See Also

Transforming a Result

func map<NewSuccess>((Success) -> NewSuccess) -> Result<NewSuccess, Failure>

Returns a new result, mapping any success value using the given transformation.

func mapError<NewFailure>((Failure) -> NewFailure) -> Result<Success, NewFailure>

Returns a new result, mapping any failure value using the given transformation.

func flatMapError<NewFailure>((Failure) -> Result<Success, NewFailure>) -> Result<Success, NewFailure>

Returns a new result, mapping any failure value using the given transformation and unwrapping the produced result.