transposeOut method

Result<S, F>? transposeOut()

transposes a Result of a nullable type into a nullable Result. Note: transposeOut is named as such otherwise there is ambiguity if named the same as transposeIn (transpose).

Implementation

Result<S, F>? transposeOut() {
  if (isOk()) {
    final val = unwrap();
    if (val == null) {
      return null;
    } else {
      return Ok(val);
    }
  } else {
    return Err(unwrapErr());
  }
}