ok<T2> method

Result<T2> ok<T2>(
  1. T2 f(
    1. T
    )
)

If result is Err then returns this Err as is. If result is Ok then returns result of call f(result.val). Result of call f() must be a value of type T2.

Implementation

Result<T2> ok<T2>(T2 Function(T) f) {
  return isErr ? Err<T2>(err) : Ok(f(unwrap));
}