Skip to content

Metadata ergonomics #327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
molpopgen opened this issue Oct 4, 2022 · 3 comments · Fixed by #350
Closed

Metadata ergonomics #327

molpopgen opened this issue Oct 4, 2022 · 3 comments · Fixed by #350
Labels
API breaking Issues/PRs that may break API. ergonomics Issues/PRs related to API ergonomics

Comments

@molpopgen
Copy link
Member

The current metadata API returns Result<Option<_>, _>. The error state happens when inputs are out of bounds. We should take a clue here from stdlib and just return None for such out of bounds cases.

IMO, it is worth it to streamline code using this part of the API.

@molpopgen molpopgen added API breaking Issues/PRs that may break API. ergonomics Issues/PRs related to API ergonomics labels Oct 4, 2022
@molpopgen
Copy link
Member Author

There are 2 sources of error:

  • range errors.
  • decoding errors.

The latter is the main ergonomic issue.
Here, it may be that the best thing to do is to recommend using Result::ok.

@molpopgen
Copy link
Member Author

Closing this -- the entire lib treats out of range as an error and we still have to worry about serde, etc., failing. No sense in breaking API for no reason.

@molpopgen
Copy link
Member Author

Reopening -- it'd be nice to be more idiomatic w/respect to indexes not in range.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API breaking Issues/PRs that may break API. ergonomics Issues/PRs related to API ergonomics
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant