-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add RingBuf::as_slices #19159
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
Comments
I think this is a pretty good idea. I've also considered the possibility of a potentially more expensive method that ensures that the contents are all contiguous, and then spits out a single slice, so that you can use all the slice utilities. Would that be useful to you? |
CC @aturon |
I need to be able to handle the case where it's not contiguous, so would that mean the code ends up looking something like:
It would save the work of constructing an extra slice when it's unnecessary, but would it add branching in the rest of the cases? Would it be more or less performant to return something like:
|
@gankro I'm happy to see a method like this land. |
I'll add it to the hypothetical collections reform part 2. |
Closed in #19903. Thanks everybody! |
fix: Set `RUSTUP_TOOLCHAIN` when loading sysroot workspace
It would be nice to have something like
pub fn as_slices(&'a self) -> (&'a [T], &'a [T])
for bulk access ofRingBuf
data (e.g. for supplying to OpenGL without lots ofglBufferSubData
calls and without copying to an intermediate buffer).The text was updated successfully, but these errors were encountered: