Package 

Interface Result


  • 
    public interface Result<T extends Object>
    
                        

    Represents the result of an operation - typically loading - that can be in a loading, error, or success state. This includes Rive file loading. The Success result must be unwrapped to the value, e.g. through Kotlin's when/is statements.

    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.
      • sequence

         <T extends Any> Result<List<T>> sequence(Iterable<Result<T>> $self)

        Convenience to join a list of Results into a Result of one List. Any loading or error states will become the final Result state.