cairo icon indicating copy to clipboard operation
cairo copied to clipboard

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

Open enitrat opened this issue 2 years ago • 1 comments

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 avatar Oct 13 '23 13:10 enitrat

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

wraitii avatar Nov 08 '23 14:11 wraitii