Option
related operations.
Some
value, consuming the self
value.
None
with a custom felt252
panic message err
.
Some
value, consuming the self
value.
self
value equals None
.
Option
into a Result
, mapping Some(v)
to
Ok(v)
and None
to Err(err)
.
Option
into a Result
, mapping Some(v)
to
Ok(v)
and None
to Err(err())
.
None
if the option is None
, otherwise returns optb
.
Arguments passed to and
are eagerly evaluated; if you are passing the
result of a function call, it is recommended to use and_then
, which is
lazily evaluated.
None
if the option is None
, otherwise calls f
with the
wrapped value and returns the result.
Some languages call this operation flatmap.
optb
.
Arguments passed to or
are eagerly evaluated; if you are passing the
result of a function call, it is recommended to use or_else
, which is
lazily evaluated.
f
and
returns the result.
Some
if exactly one of self
, optb
is Some
, otherwise returns None
.
true
if the Option
is Some
, false
otherwise.
true
if the Option
is Some
and the value inside of it matches a
predicate.
true
if the Option
is None
, false
otherwise.
true
if the Option
is None
or the value inside of it matches a
predicate.
Some
value if self
is Some(x)
. Otherwise, returns the
provided default.
Some
value if self
is Some(x)
. Otherwise, returns
Default::::default()
.
Some
value or computes it from a closure.
Option
to Option
by applying a function to a contained value (if Some
)
or returns None
(if None
).
map_or
are eagerly evaluated; if you are passing
the result of a function call, it is recommended to use map_or_else
,
which is lazily evaluated.
None
in its place.
None
if the option is None
, otherwise calls predicate
with the wrapped value and returns:
Some(t)
if predicate
returns true
(where t
is the wrapped
value), andNone
if predicate
returns false
.Option>
to Option
.