question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implement method into_ok_or_err for Result<T, T>

See original GitHub issue

I think it’d be nice to be able to write something like

val a = res.map { it.joinToString("\n") }.into_ok_or_err()

instead of

val a = when (res) {
    is Ok -> res.unwrap().joinToString("\n") // -> String
    is Err -> res.unwrapError() // -> String
}

This feature already exists in Rust Nightly.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
michaelbullcommented, Jun 17, 2021

Does this differ from merge?

0reactions
michaelbullcommented, Jun 17, 2021

No worries, here’s the wiki entry for it if that helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Untitled
A Rust Result<T, E> inspired interface for handling results. Result is a type that represents either success (Ok) or failure (Err).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found