okOr<E> method
Transforms the Option into a Result, mapping Some(v)
to
Ok(v)
and None
to Err(err)
.
Arguments passed to okOr
are eagerly evaluated; if you are passing the
result of a function call, it is recommended to use okOrElse, which is
lazily evaluated.
Implementation
Result<T, E> okOr<E>(E err) => isSome ? Ok(_someValue) : Err(err);