Generic Instance Method

flatMapError(_:)

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

Declaration

func flatMapError<NewFailure>(_ transform: (Failure) -> Result<Success, NewFailure>) -> Result<Success, NewFailure> where NewFailure : Error

Parameters

transform

A closure that takes the failure value of the instance.

Return Value

A Result instance, either from the closure or the previous .success.

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 flatMap<NewSuccess>((Success) -> Result<NewSuccess, Failure>) -> Result<NewSuccess, Failure>

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