Skip to content

Refactor Array::slice_as_chunks(_mut) #31

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

Merged
merged 1 commit into from
Jan 29, 2024

Conversation

tarcieri
Copy link
Member

Moves them from being free functions to inherent methods on Array.

This avoids having to import them separately.

Moves them from being free functions to inherent methods on `Array`.

This avoids having to import them separately.
@tarcieri tarcieri requested a review from newpavlov January 28, 2024 00:27
@tarcieri
Copy link
Member Author

@newpavlov if you'd like to leave these as free functions I'm fine with that too. There's certainly precedent for that sort of thing in core::array.

Copy link
Member

@newpavlov newpavlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with both options, but the inherent methods look slightly more ergonomic. Not only you do not have to explicitly import them, but they also can simplify type hinting, i.e. we will be able to write Block::slice_as_chunks(buf).

@tarcieri
Copy link
Member Author

Yeah, that should be useful

@tarcieri tarcieri merged commit f68ed30 into master Jan 29, 2024
@tarcieri tarcieri deleted the make-slice-as-chunks-inherent-methods branch January 29, 2024 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants