Option
fn map[A, B](opt: Option[A], f: fn(A) -> B fails E(f) uses { R(f) }) -> Option[B] fails E(f) uses { R(f) }Applies f to the contents of a Some. None stays None.
and_then
Section titled “and_then”fn and_then[A, B](opt: Option[A], f: fn(A) -> Option[B] fails E(f) uses { R(f) }) -> Option[B] fails E(f) uses { R(f) }Applies f, which returns an Option, to the contents of a Some and flattens the
result. None stays None.
fn or[A](opt: Option[A], default: A) -> AThe value, or default if None.
is_some
Section titled “is_some”fn is_some[A](opt: Option[A]) -> BoolWhether it is Some.
is_none
Section titled “is_none”fn is_none[A](opt: Option[A]) -> BoolWhether it is None.
or_fail
Section titled “or_fail”fn or_fail[A, E](opt: Option[A], err: E) -> A fails EFails with err if None ([error.fail]). Turns an Option into a failure, as in
users.find(id).or_fail(NotFound(id:)).