okOr<E> method

Result<T, E> okOr<E>(
  1. E err
)

Converts this Option<T> into a Result<T, E> using the given err if None.

Values passed for err are eagerly evaluated. Consider using Option.okOrElse() to provide an error value that will not be evaluated unless this Option is None.

Returns:

See also: Rust: Option::ok_or()

Implementation

Result<T, E> okOr<E>(E err) => switch (this) {
	Some(value: T value) => Ok(value),
	None() => Err(err)
};