-
Notifications
You must be signed in to change notification settings - Fork 20
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
add ReadBuf::buf* accessor functions for getting the original buffer #65
Comments
rust-lang/rust#97015 already aims to address that. |
Could we also have some way to extract the initialized bytes from the After using this API a little bit, I encountered a pattern that I think would be fairly common:
Without such an API I have to manually write unsafe code to convert my original Could we include a method that looks like: #[inline]
pub fn into_filled_buf(self) -> &'a mut [u8] {
unsafe { MaybeUninit::slice_assume_init_mut(&mut self.buf[0..self.filled]) }
} |
We discussed this in today's libs meetup. As far as we can tell, the new BorrowedCursor API no longer allows swapping out the buffer, so the comment in the original motivation no longer holds. It should be possible to just use the original buffer. If that's not the case, and there's still a use case for this. please follow up with an explanation of that use case. |
Proposal
Problem statement
There is no way to retrieve the full, originally passed in buffer from
ReadBuf
Motivation, use-cases
Solution sketches
Links and related work
rust-lang/rust#98962
rust-lang/rust#78485
What happens now?
This issue is part of the libs-api team API change proposal process. Once this issue is filed the libs-api team will review open proposals in its weekly meeting. You should receive feedback within a week or two.
The text was updated successfully, but these errors were encountered: