Some<T>
extension type
Represents a value that is present. The erasure of this is T
.
- on
-
- T
- Implemented types
-
- Option<
T>
- Option<
- Available extensions
- Option$OptionMethodsExtension
- Option$OptionNestedRecord3Extension
- Option$OptionNestedRecord4Extension
- Option$OptionNestedRecord5Extension
- Option$OptionNullableExtension
- Option$OptionOptionExtension
- Option$OptionRecord2Extension
- Option$OptionResultExtension
- Option$SomeMethodsExtension
- Option$ToFutureOptionExtension
Constructors
- Some(T v)
-
const
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 Option$OptionMethodsExtension extensionother
. -
and<
U extends Object> (Option< U> other) → Option<U> -
Available on Some<
T> , provided by the Option$SomeMethodsExtension extension -
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 Option$OptionMethodsExtension extension -
andThen<
U extends Object> (Option< U> f(T self)) → Option<U> -
Available on Some<
T> , provided by the Option$SomeMethodsExtension extension -
copy(
) → Some< T> -
Available on Some<
T> , provided by the Option$SomeMethodsExtension extension -
expect(
String msg) → T -
Available on Option<
Returns the contained Some value if Some, otherwise throws a Panic.T> , provided by the Option$OptionMethodsExtension extension -
expect(
String msg) → T -
Available on Some<
T> , provided by the Option$SomeMethodsExtension extension -
filter(
bool predicate(T self)) → Option< T> -
Available on Some<
T> , provided by the Option$SomeMethodsExtension 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 Option$OptionMethodsExtension extension -
flatten(
) → Option< T> -
Available on Option<
Converts from Option<OptionOption< , provided by the Option$OptionOptionExtension extensionT> > -
flatten(
) → Option< (A, B, C)> -
Available on Option<
Flattens an option into a single tuple.((A, B), C)> , provided by the Option$OptionNestedRecord3Extension extension -
flatten(
) → Option< (A, B, C, D)> -
Available on Option<
Flattens an option into a single tuple.(((A, B), C), D)> , provided by the Option$OptionNestedRecord4Extension extension -
flatten(
) → Option< (A, B, C, D, E)> -
Available on Option<
Flattens an option into a single tuple.((((A, B), C), D), E)> , provided by the Option$OptionNestedRecord5Extension extension -
flatten(
) → Option< T> -
Available on Option<
Converts from Option<T?> to OptionT?> , provided by the Option$OptionNullableExtension extension -
inspect(
dynamic f(T self)) → Some< T> -
Available on Some<
T> , provided by the Option$SomeMethodsExtension extension -
inspect(
dynamic f(T)) → Option< T> -
Available on Option<
Calls the provided closure with a reference to the contained valueT> , provided by the Option$OptionMethodsExtension extension -
isNone(
) → bool -
Available on Option<
Returns true if the option is a None value.T> , provided by the Option$OptionMethodsExtension extension -
isNone(
) → bool -
Available on Some<
T> , provided by the Option$SomeMethodsExtension extension -
isSome(
) → bool -
Available on Option<
Returns true if the option is a Some value.T> , provided by the Option$OptionMethodsExtension extension -
isSome(
) → bool -
Available on Some<
T> , provided by the Option$SomeMethodsExtension 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 Option$OptionMethodsExtension extension -
isSomeAnd(
bool f(T self)) → bool -
Available on Some<
T> , provided by the Option$SomeMethodsExtension extension -
iter(
) → Iter< T> -
Available on Some<
T> , provided by the Option$SomeMethodsExtension extension -
iter(
) → Iter< T> -
Available on Option<
Returns an Iter over the possibly contained value.T> , provided by the Option$OptionMethodsExtension extension -
map<
U extends Object> (U f(T self)) → Some< U> -
Available on Some<
T> , provided by the Option$SomeMethodsExtension extension -
map<
U extends Object> (U f(T)) → Option< U> -
Available on Option<
Maps an this OptionT> , provided by the Option$OptionMethodsExtension extension -
mapOr<
U> (U defaultValue, U f(T)) → U -
Available on Some<
T> , provided by the Option$SomeMethodsExtension 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 Option$OptionMethodsExtension extension -
mapOrElse<
U> (U defaultFn(), U f(T)) → U -
Available on Some<
T> , provided by the Option$SomeMethodsExtension 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 Option$OptionMethodsExtension extension -
okOr<
E extends Object> (E err) → Ok< T, Never> -
Available on Some<
T> , provided by the Option$SomeMethodsExtension extension -
okOr<
E extends Object> (E err) → Result< T, E> -
Available on Option<
Transforms the OptionT> , provided by the Option$OptionMethodsExtension extension -
okOrElse<
E extends Object> (E errFn()) → Ok< T, Never> -
Available on Some<
T> , provided by the Option$SomeMethodsExtension extension -
okOrElse<
E extends Object> (E errFn()) → Result< T, E> -
Available on Option<
Transforms the OptionT> , provided by the Option$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 Option$OptionMethodsExtension extension -
or(
Option< T> other) → Some<T> -
Available on Some<
T> , provided by the Option$SomeMethodsExtension 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 Option$OptionMethodsExtension extension -
orElse(
Option< T> f()) → Some<T> -
Available on Some<
T> , provided by the Option$SomeMethodsExtension extension -
toFutureOption(
) → Future< Option< T> > -
Available on Option<
Converts a OptionT> , provided by the Option$ToFutureOptionExtension extension -
transpose(
) → Result< Option< S> , F> -
Available on Option<
Transposes an Option of a Result into a Result of an Option.Result< , provided by the Option$OptionResultExtension extensionS?, F> > -
unwrap(
) → T -
Available on Option<
Returns the contained Some value, consuming the self value.T> , provided by the Option$OptionMethodsExtension extension -
unwrap(
) → T -
Available on Some<
T> , provided by the Option$SomeMethodsExtension extension -
unwrapOr(
T defaultValue) → T -
Available on Option<
Returns the contained Some value or a provided default.T> , provided by the Option$OptionMethodsExtension extension -
unwrapOr(
T defaultValue) → T -
Available on Some<
T> , provided by the Option$SomeMethodsExtension extension -
unwrapOrElse(
T f()) → T -
Available on Option<
Returns the contained Some value or computes it from a closure.T> , provided by the Option$OptionMethodsExtension extension -
unwrapOrElse(
T f()) → T -
Available on Some<
T> , provided by the Option$SomeMethodsExtension extension -
unzip(
) → (Option< T> , Option<U> ) -
Available on Option<
Unzips an option containing a tuple of two options. If self is Some((a, b)) this method returns (Some(a), Some(b)). Otherwise, (None, None) is returned.(T, U)> , provided by the Option$OptionRecord2Extension extension -
xor(
Option< T> other) → Option<T> -
Available on Option<
Returns Some if exactly one of self,T> , provided by the Option$OptionMethodsExtension extensionother
is Some, otherwise returns None. -
xor(
Option< T> other) → Option<T> -
Available on Some<
T> , provided by the Option$SomeMethodsExtension extension -
zip<
U extends Object> (Option< U> other) → Option<(T, U)> -
Available on Option<
Zips self with another Option.T> , provided by the Option$OptionMethodsExtension extension -
zip<
U extends Object> (Option< U> other) → Option<(T, U)> -
Available on Some<
T> , provided by the Option$SomeMethodsExtension 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 Option$OptionMethodsExtension extension -
zipWith<
U extends Object, R extends Object> (Option< U> other, R f(T p1, U p2)) → Option<R> -
Available on Some<
T> , provided by the Option$SomeMethodsExtension extension
Operators
-
operator [](
_OptionEarlyReturnKey op) → T -
Available on Option<
Functions an "Early Return Operator" when given an "Early Return key" "$". SeeT> , provided by the Option$OptionMethodsExtension extensionOption.$
for more information. -
operator [](
_OptionEarlyReturnKey op) → T -
Available on Some<
T> , provided by the Option$SomeMethodsExtension extension