Skip to content
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

the at method on Array (and Span) returns @T while on ByteArray it returns Option<T>. #4255

Open
enitrat opened this issue Oct 13, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@enitrat
Copy link
Contributor

enitrat commented Oct 13, 2023

I think that keeping a consistent interface between the three is important for a good developer experience.

Proposal:

  • First, introduce a get method on ByteArray that returns Option<T> (could even be Option<@T> if we want maximum consistency, but unlike for "natural" arrays this doesn't really make sense)
  • Refactor at to return T(or @T) or panic, like arrays
  • Refactor ByteArrayIndexView to just return what self.at(index) returns, no more need for error management since we refactored at()

I can submit a PR if agreed

@enitrat enitrat added the enhancement New feature or request label Oct 13, 2023
@wraitii
Copy link
Contributor

wraitii commented Nov 8, 2023

(These should also be separate traits IMO instead of methods on array/bytearray)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants