Some<T> extension type

Represents a value that is present. The erasure of this is T.

on
  • T
Implemented types
Available extensions

Constructors

Some(T v)
const

Properties

v → T
final
value → T
no setteroverride

Methods

and<U extends Object>(Option<U> other) Option<U>

Available on Option<T>, provided by the Option$OptionMethodsExtension extension

Returns None if the option is None, otherwise returns other.
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<T>, provided by the Option$OptionMethodsExtension extension

Returns None if the option is None, otherwise calls f with the wrapped value and returns the result. Some languages call this operation flatmap.
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<T>, provided by the Option$OptionMethodsExtension extension

Returns the contained Some value if Some, otherwise throws a Panic.
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<T>, provided by the Option$OptionMethodsExtension extension

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), and
flatten() Option<T>

Available on Option<Option<T>>, provided by the Option$OptionOptionExtension extension

Converts from Option<Option
flatten() Option<(A, B, C)>

Available on Option<((A, B), C)>, provided by the Option$OptionNestedRecord3Extension extension

Flattens an option into a single tuple.
flatten() Option<(A, B, C, D)>

Available on Option<(((A, B), C), D)>, provided by the Option$OptionNestedRecord4Extension extension

Flattens an option into a single tuple.
flatten() Option<(A, B, C, D, E)>

Available on Option<((((A, B), C), D), E)>, provided by the Option$OptionNestedRecord5Extension extension

Flattens an option into a single tuple.
flatten() Option<T>

Available on Option<T?>, provided by the Option$OptionNullableExtension extension

Converts from Option<T?> to Option
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<T>, provided by the Option$OptionMethodsExtension extension

Calls the provided closure with a reference to the contained value
isNone() bool

Available on Option<T>, provided by the Option$OptionMethodsExtension extension

Returns true if the option is a None value.
isNone() bool

Available on Some<T>, provided by the Option$SomeMethodsExtension extension

isSome() bool

Available on Option<T>, provided by the Option$OptionMethodsExtension extension

Returns true if the option is a Some value.
isSome() bool

Available on Some<T>, provided by the Option$SomeMethodsExtension extension

isSomeAnd(bool f(T)) bool

Available on Option<T>, provided by the Option$OptionMethodsExtension extension

Returns true if the option is a Some and the value inside of it matches a predicate.
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<T>, provided by the Option$OptionMethodsExtension extension

Returns an Iter over the possibly contained value.
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<T>, provided by the Option$OptionMethodsExtension extension

Maps an this Option
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<T>, provided by the Option$OptionMethodsExtension extension

Returns the provided default result (if none), or applies a function to the contained value (if any).
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<T>, provided by the Option$OptionMethodsExtension extension

Computes a default function result (if none), or applies a different function to the contained value (if any).
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<T>, provided by the Option$OptionMethodsExtension extension

Transforms the Option
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<T>, provided by the Option$OptionMethodsExtension extension

Transforms the Option
or(Option<T> other) Option<T>

Available on Option<T>, provided by the Option$OptionMethodsExtension extension

Returns the option if it contains a value, otherwise returns other.
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<T>, provided by the Option$OptionMethodsExtension extension

Returns the option if it contains a value, otherwise calls f and returns the result.
orElse(Option<T> f()) Some<T>

Available on Some<T>, provided by the Option$SomeMethodsExtension extension

toFutureOption() Future<Option<T>>

Available on Option<T>, provided by the Option$ToFutureOptionExtension extension

Converts a Option
transpose() → Result<Option<S>, F>

Available on Option<Result<S?, F>>, provided by the Option$OptionResultExtension extension

Transposes an Option of a Result into a Result of an Option.
unwrap() → T

Available on Option<T>, provided by the Option$OptionMethodsExtension extension

Returns the contained Some value, consuming the self value.
unwrap() → T

Available on Some<T>, provided by the Option$SomeMethodsExtension extension

unwrapOr(T defaultValue) → T

Available on Option<T>, provided by the Option$OptionMethodsExtension extension

Returns the contained Some value or a provided default.
unwrapOr(T defaultValue) → T

Available on Some<T>, provided by the Option$SomeMethodsExtension extension

unwrapOrElse(T f()) → T

Available on Option<T>, provided by the Option$OptionMethodsExtension extension

Returns the contained Some value or computes it from a closure.
unwrapOrElse(T f()) → T

Available on Some<T>, provided by the Option$SomeMethodsExtension extension

unzip() → (Option<T>, Option<U>)

Available on Option<(T, U)>, provided by the Option$OptionRecord2Extension extension

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.
xor(Option<T> other) Option<T>

Available on Option<T>, provided by the Option$OptionMethodsExtension extension

Returns Some if exactly one of self, other 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<T>, provided by the Option$OptionMethodsExtension extension

Zips self with another Option.
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<T>, provided by the Option$OptionMethodsExtension extension

Zips self and another Option with function f
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<T>, provided by the Option$OptionMethodsExtension extension

Functions an "Early Return Operator" when given an "Early Return key" "$". See Option.$ for more information.
operator [](_OptionEarlyReturnKey op) → T

Available on Some<T>, provided by the Option$SomeMethodsExtension extension