and<U> abstract method

  1. @useResult
Result<U, E> and<U>(
  1. Result<U, E> other
)

Returns other if this is an Ok, or an Err of the original error otherwise.

Examples

// prints "Ok(3)"
print(const Ok<int, String>(2).and(const Ok(3)));

// prints "Err(error)"
print(const Err<int, String>('error').and(const Ok(3)));

Implementation

@useResult
Result<U, E> and<U>(Result<U, E> other);