-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classResult.Loadingpublic final classResult.Errorpublic final classResult.Success
-
Method Summary
Modifier and Type Method Description <T extends Any, R extends Any> Result<R>andThen(Result<T> $self, Function1<T, Result<R>> onSuccess)Convenience to chain the result of one Result into another, forwarding loading and error states, and mapping the success to another Result. <A extends Any, B extends Any, R extends Any> Result<R>zip(Result<A> $self, Result<B> other, Function2<A, B, R> combine)Convenience to join two Results into one, forwarding loading and error states, and mapping the combination to another Result. <A extends Any, B extends Any> Result<Pair<A, B>>zip(Result<A> $self, Result<B> other)Convenience to join two Results into one, forwarding loading and error states, and mapping the combination to a Pair. <T extends Any> Result<List<T>>sequence(Iterable<Result<T>> $self)Convenience to join a list of Results into a Result of one List. -
-
Method Detail
-
andThen
@Composable() <T extends Any, R extends Any> Result<R> andThen(Result<T> $self, Function1<T, Result<R>> onSuccess)
Convenience to chain the result of one Result into another, forwarding loading and error states, and mapping the success to another Result.
- Parameters:
onSuccess- The mapping function to apply to a Success result.
-
zip
<A extends Any, B extends Any, R extends Any> Result<R> zip(Result<A> $self, Result<B> other, Function2<A, B, R> combine)
Convenience to join two Results into one, forwarding loading and error states, and mapping the combination to another Result.
- Parameters:
other- The other Result to combine with.combine- The mapping function to apply to the two values, e.g.
-
zip
<A extends Any, B extends Any> Result<Pair<A, B>> zip(Result<A> $self, Result<B> other)
Convenience to join two Results into one, forwarding loading and error states, and mapping the combination to a Pair.
- Parameters:
other- The other Result to combine with.
-
-
-
-