Extractors<T, E> extension
Extract value or error
- on
-
- Result<
T, E>
- Result<
Methods
-
expect(
String message) → T -
Returns the contained
ok
(success) value. -
expectErr(
String message) → E -
Returns the contained
err
(failure) value. -
unwrap(
) → T -
Returns the contained
ok
(success) value. Because this function may throw an exception, its use is generally discouraged. Instead, prefer to useswitch
statements with theResult.type
and handle theerr
(failure) case explicitly, or call`unwrapOr`
,`unwrapOrElse`
. -
unwrapErr(
) → E -
Returns the contained
err
(failure) value. -
unwrapOr(
T fallback) → T -
Returns the contained
ok
(success) value or a provided fallback. -
unwrapOrElse(
T fallback(E error)) → T -
Returns the contained
ok
(success) value or computes it from the closure.