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.

Feature requests: convenience helpers and improved spec compliance

See original GitHub issue

Some features that I’d like to contribute from my personal implementation that this one is missing. Opening issue for discussion before just opening a pull request to help eliminate unnecessary work. Some of these are convenience, some of these bring the implementations closer to the Rust spec. Porting these is little effort, as the code already exists in my own personal work.

Convenience helpers

  • function fromPromise<V, E extends Error>(promise: Promise<V>): Promise<Result<V, E>>; avoids additional microtasks
  • function fromSync<V, E extends Error>(func: () => V): Result<V, E>; synchronous helper, avoids microtasks completely
  • Symbol.toStringTag support; useful to quickly and easily distinguish resulting objects
  • Symbol.hasInstance support on Err, Ok, Some, None; example myResult instance of Err

Spec compliance

  • Iterable support, similar to class Result<T, E extends Error> implements Iterable<T>
  • Result.expectErr

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
aaronhugginscommented, Oct 27, 2022

I’ll add as comments in PR.

0reactions
OliverBrotchiecommented, Oct 27, 2022

Oh sorry! 😆

Yeah if you could provide some snippets that would be great!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature Requests: What are they and how to manage them
Feature requests are a form of product feedback you may frequently encounter as a SaaS product manager. They typically come in the form...
Read more >
Customer Match policy - Advertising Policies Help
Features available to advertisers depend on which requirements your account satisfies: All policy compliant advertisers can use Customer Match and similar ...
Read more >
Microsoft 365 guidance for security & compliance
This article provides guidance for Microsoft 365 compliance to help avoid potential service disruption due to unlicensed access.
Read more >
How to Manage Product Feature Requests – 6 Best Practices
Managing your feature requests better will help you to: Keep track of product ideas,; Prioritize product features,; Improve your user experience ...
Read more >
Using the Feature Request Details Page in Savio
Savio lets you do more than just capture feedback and use it to help you prioritize feature requests. It can also help you...
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