Std.Result
24 public declarations
- all
&Array[Result[T, E]] -> Result[Array[T], E]Every success, or the first failure.
- andThen
Result[T, E] -> fn(T) -> Result[U, E] -> Result[U, E]The success transformed into another result, flattened.
- err
Result[T, E] -> Option[E]The failure if there was one.
- errOr
Result[T, E] -> E -> EThe failure, or a fallback when the operation succeeded.
- failures
&Array[Result[T, E]] -> Array[E]Every failure, with the successes dropped.
- flatten
Result[Result[T, E], E] -> Result[T, E]A nested result flattened by one level.
- fold
Result[T, E] -> fn(T) -> A -> fn(E) -> A -> AOne of two transformations, whichever side the result holds.
- holds
&Result[T, E] -> fn(T) -> Bool -> BoolWhether the operation succeeded and the predicate accepts the value.
- isErr
&Result[T, E] -> BoolWhether the operation failed.
- isOk
&Result[T, E] -> BoolWhether the operation succeeded.
- map
Result[T, E] -> fn(T) -> U -> Result[U, E]The success transformed, if there was one.
- map2
Result[T, E] -> Result[U, E] -> fn(T, U) -> V -> Result[V, E]Both successes combined, or the first failure.
- mapErr
Result[T, E] -> fn(E) -> F -> Result[T, F]The failure transformed, if there was one.
- ok
Result[T, E] -> Option[T]The value if there is one, forgetting why there was not.
- orElse
Result[T, E] -> Result[T, E] -> Result[T, E]The first result if it succeeded, otherwise the second.
- partition
&Array[Result[T, E]] -> (Array[T], Array[E])The two sides separated: every success, and every failure.
- require
Bool -> E -> Result[(), E]A success when a condition holds, and a named failure otherwise.
- successes
&Array[Result[T, E]] -> Array[T]Every success, with the failures dropped.
- swap
Result[T, E] -> Result[E, T]The sides exchanged, so a failure becomes a success and back.
- toArray
Result[T, E] -> Array[T]The value as an array of nought or one element.
- toOption
Result[T, E] -> Option[T]The success, or `None` when there was a failure, keeping neither.
- traverse
&Array[A] -> fn(A) -> Result[B, E] -> Result[Array[B], E]Every result transformed and collected, stopping at the first failure.
- unwrapOr
Result[T, E] -> T -> TThe value, or a fallback when the operation failed.
- unwrapOrElse
Result[T, E] -> fn(E) -> T -> TThe success, or a fallback computed from the failure.
