Skip to content

Instantly share code, notes, and snippets.

@Drjacky
Created November 7, 2018 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Drjacky/ae2a0e6d1cabbb1f8b108101ca7da123 to your computer and use it in GitHub Desktop.
Save Drjacky/ae2a0e6d1cabbb1f8b108101ca7da123 to your computer and use it in GitHub Desktop.
Wrapping and Composing data
protected fun <D> wrapResult(): SingleTransformer<D, ResultState<D>> = SingleTransformer {
it.map { d -> ResultState.Success(d) as ResultState<D> }
.onErrorReturn { e -> ResultState.Error(e, null) }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment