feat/chore: introduce fallible alternatives for MutableBuffer#10317
Open
Rich-T-kid wants to merge 1 commit into
Open
feat/chore: introduce fallible alternatives for MutableBuffer#10317Rich-T-kid wants to merge 1 commit into
Rich-T-kid wants to merge 1 commit into
Conversation
Contributor
Author
once this is merged Ill work on updating call sites. From my understanding this isn't always a 1-1 switch, its only possible to use the fallible alternative if the calling functions also returns an error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
see #9843.
MutableBufferis a low-level building block used throughout the Arrow implementation. Every growth operation,reserve,resize,push,extend_from_slice, etc, can panic on arithmetic overflow or an invalid allocation layout. In library code that needs to surface errors gracefully. This PR adds methods to return errors instead of panicking.I made new methods instead of adding conditional checks/wrappers for each method because its easier to slowly roll these changes out to call sites instead of swapping.
What changes are included in this PR?
Are these changes tested?
Currently these methods aren't wired up to anything in the code base so I didn't include any test. Id be happy to include some. The implementations of the fallible API's are 1-1 to their non-fallible counter parts so i'm not sure if this would be needed.
Are there any user-facing changes?
yes, users can now work with errors instead of having their programs panic.