Add deprecations and new methods to prep for IO rewrite#216
Merged
Conversation
kskalski
reviewed
Mar 5, 2026
Contributor
kskalski
left a comment
There was a problem hiding this comment.
Looks good, I would just use the opportunity to improve the comments for borrow functions slightly
kskalski
approved these changes
Mar 6, 2026
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.
In prep for #213, this PR deprecates methods that will be removed in next breaking release (
0.5), and adds new methods that will be included in #213 to make migration possible before switching to0.5.Deprecated methods
fill_buf: usecopy_into_sliceif you ultimately intend to copy the slice, ortake_scopedfor a call-scoped borrow. Be advised thattake_scopedmay not be implemented for all readers.fill_exact: usecopy_into_sliceif you ultimately intend to copy the slice, ortake_scopedfor a call-scoped borrow. Be advised thattake_scopedmay not be implemented for all readers.fill_array: usetake_array.copy_into_array: usetake_arrayorcopy_into_slice.borrow_exact: usetake_borrowed.borrow_exact_mut: usetake_borrowed_mut.consume_unchecked- use one of thetake_*methods, which automatically advance the reader.consume- use one of thetake_*methods, which automatically advance the reader.peek- usetake_byte.New methods
take_byte: Return the next byte and advance by1.take_borrowed: Replacesborrow_exact.take_borrowed_mut: Replacesborrow_exact_mut.take_scoped: Return a call-site scoped immutable slice. The returned slice is tied to the borrow ofself, meaning it is only valid while the current borrow of the reader is alive. Implementations are free to return slices backed by internal buffers or transient windows into the underlying source. This method is intended to be optional liketake_borrowedandtake_borrowed_mut, and return an error by default.