zipWith<U, V> method

Option<V> zipWith<U, V>(
  1. Option<U> other,
  2. V zipFn(
    1. T,
    2. U
    )
)

Zips this Option with another Option using the given function.

Returns:

See also: Rust: Option::zip_with()

Implementation

Option<V> zipWith<U, V>(Option<U> other, V Function(T, U) zipFn) {
  return switch ((this, other)) {
    (Some(v: T a), Some(v: U b)) => Some(zipFn(a, b)),
    _ => None(),
  };
}