OptionMethodsExtension<T extends Object> extension
- on
-
- Option<
T>
- Option<
Methods
-
and<
U extends Object> (Option< U> other) → Option<U> -
Available on Option<
Returns None if the option is None, otherwise returnsT> , provided by the OptionMethodsExtension extensionother
. -
andThen<
U extends Object> (Option< U> f(T)) → Option<U> -
Available on Option<
Returns None if the option is None, otherwise calls f with the wrapped value and returns the result. Some languages call this operation flatmap.T> , provided by the OptionMethodsExtension extension -
expect(
String msg) → T -
Available on Option<
Returns the contained Some value if Some, otherwise throws a Panic.T> , provided by the OptionMethodsExtension extension -
filter(
bool predicate(T)) → Option< T> -
Available on Option<
Returns 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), andT> , provided by the OptionMethodsExtension extension -
inspect(
dynamic f(T)) → Option< T> -
Available on Option<
Calls the provided closure with a reference to the contained valueT> , provided by the OptionMethodsExtension extension -
isNone(
) → bool -
Available on Option<
Returns true if the option is a None value.T> , provided by the OptionMethodsExtension extension -
isSome(
) → bool -
Available on Option<
Returns true if the option is a Some value.T> , provided by the OptionMethodsExtension extension -
isSomeAnd(
bool f(T)) → bool -
Available on Option<
Returns true if the option is a Some and the value inside of it matches a predicate.T> , provided by the OptionMethodsExtension extension -
iter(
) → Iter< T> -
Available on Option<
Returns an Iter over the possibly contained value.T> , provided by the OptionMethodsExtension extension -
map<
U extends Object> (U f(T)) → Option< U> -
Available on Option<
Maps an this OptionT> , provided by the OptionMethodsExtension extension -
mapOr<
U> (U defaultValue, U f(T)) → U -
Available on Option<
Returns the provided default result (if none), or applies a function to the contained value (if any).T> , provided by the OptionMethodsExtension extension -
mapOrElse<
U> (U defaultFn(), U f(T)) → U -
Available on Option<
Computes a default function result (if none), or applies a different function to the contained value (if any).T> , provided by the OptionMethodsExtension extension -
okOr<
E extends Object> (E err) → Result< T, E> -
Available on Option<
Transforms the OptionT> , provided by the OptionMethodsExtension extension -
okOrElse<
E extends Object> (E errFn()) → Result< T, E> -
Available on Option<
Transforms the OptionT> , provided by the OptionMethodsExtension extension -
or(
Option< T> other) → Option<T> -
Available on Option<
Returns the option if it contains a value, otherwise returns other.T> , provided by the OptionMethodsExtension extension -
orElse(
Option< T> f()) → Option<T> -
Available on Option<
Returns the option if it contains a value, otherwise calls f and returns the result.T> , provided by the OptionMethodsExtension extension -
toNullable(
) → T? -
Available on Option<
Returns the inner type as the nullable version ofT> , provided by the OptionMethodsExtension extensionT
-
unwrap(
) → T -
Available on Option<
Returns the contained Some value, consuming the self value.T> , provided by the OptionMethodsExtension extension -
unwrapOr(
T defaultValue) → T -
Available on Option<
Returns the contained Some value or a provided default.T> , provided by the OptionMethodsExtension extension -
unwrapOrElse(
T f()) → T -
Available on Option<
Returns the contained Some value or computes it from a closure.T> , provided by the OptionMethodsExtension extension -
xor(
Option< T> other) → Option<T> -
Available on Option<
Returns Some if exactly one of self,T> , provided by the OptionMethodsExtension extensionother
is Some, otherwise returns None. -
zip<
U extends Object> (Option< U> other) → Option<(T, U)> -
Available on Option<
Zips self with another Option.T> , provided by the OptionMethodsExtension extension -
zipWith<
U extends Object, R extends Object> (Option< U> other, R f(T, U)) → Option<R> -
Available on Option<
Zips self and another Option with function fT> , provided by the OptionMethodsExtension extension
Operators
-
operator [](
_OptionEarlyReturnKey op) → T -
Available on Option<
Functions an "Early Return Operator" when given an "Early Return key" "$". SeeT> , provided by the OptionMethodsExtension extensionOption.$
for more information.