map


Description:

public Result<U,E> map<U> (owned MapFunc<T,U> func)

If this is a success, applies the function to the value and returns a new Result. If this is an error, returns the error unchanged.

Example:

    var r = Result.ok<string,string> ("hello");
var mapped = r.map<string> ((s) => { return s.up (); });
assert (mapped.unwrap () == "HELLO");

Parameters:

func

the transformation function.

Returns:

a new Result with the transformed value.