-
Notifications
You must be signed in to change notification settings - Fork 296
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 specialized Buf::chunks_vectored
for Take
#617
add specialized Buf::chunks_vectored
for Take
#617
Conversation
Just noticed this is a duplicate of #476. Don't have a strong opinion here, please feel free to review and merge either :) |
f8ae0bb
to
1482c40
Compare
Thank you. This got lost, sorry about that. I'm rebasing it and tweaking it myself since it's been so long. |
The test was failing because this is writing to the extra slots in |
cf0477b
to
a9ec05d
Compare
10b5341
to
94e5843
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
The
h2
crate usesTake
around the data frames to enforce a maximum frame size, which breaks vectored writes sinceTake
doesn't provide a specializedchunks_vectored
that calls the underlyingchunks_vectored
.To make this work with truncating individual
IoSlice
s, I needed to resort to a tiny bit ofunsafe
code. There is a PR open (rust-lang/rust#111277) which will alleviate the need for it, but that hasn't landed yet (so unlikely to be stable any time soon).An alternative could be to just remove rather than truncate any
IoSlice
that crosses the limit threshold, which could be accomplished without any unsafe code. However, that might break the following guarantee documented onchunks_vectored
: "If chunk_vectored does not fill every entry in dst, then dst is guaranteed to contain all remaining slices in `self."Happy to go either route, let me know what you think!