T The type of the value wrapped in the Ok
of the Result
.
U The type of the value wrapped in the Ok
of the andResult
,
i.e. the success type of the Result
present if the checked
Result
is Ok
.
E The type of the value wrapped in the Err
of the Result
.
Generated using TypeDoc
You can think of this like a short-circuiting logical "and" operation on a
Result
type. Ifresult
isOk
, then the result is theandResult
. Ifresult
isErr
, the result is theErr
.This is useful when you have another
Result
value you want to provide if and only if you have anOk
– that is, when you need to make sure that if youErr
, whatever else you're handing aResult
to also gets thatErr
.Notice that, unlike in
map
or its variants, the originalresult
is not involved in constructing the newResult
.Examples