-
Notifications
You must be signed in to change notification settings - Fork 677
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 an "advance" function for the iovec
type.
#1637
Comments
Now that std has a vectored I/O API, I think it would be a VERY GOOD IDEA for Nix to follow that API as closely as possible. To that end, I suggest we simply replace nix:::sys::uio::IoVec with std::io::IoSlice. They're practically identical, after all. To ease transition, we can reexport IoSlice for a release or two. Would you be willing to submit a PR? |
Yes, I am willing to submit a PR. |
bors bot
added a commit
that referenced
this issue
Apr 8, 2022
1643: Replace the IoVec struct with IoSlice and IoSliceMut from the standard library r=asomers a=notgull As per discussion in #1637, the `IoVec<&[u8]>` and `IoVec<&mut [u8]>` types have been replaced with `std::io::IoSlice` and `IoSliceMut`, respectively. Notable changes made in this pull request include: - The complete replacement of `IoVec` with `IoSlice*` types in both public API, private API, and tests. - Replacing `IoVec` with `IoSlice` in docs. - Replacing `&[IoVec<&mut [u8]>]` with `&mut [IoSliceMut]`, note that the slice requires a mutable reference now. This is how it's done in the standard library, and there might be a soundness issue in doing it the other way. Resolves #1637 Co-authored-by: not_a_seagull <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In Rust's standard library, the
IoSlice
type has methods "advance
" and "advance_slices
", which are used to "advance" the slices by a set number of bytes. This is usually done in response to aread_vectored
call.However, the
iovec
type, necessary for the[read/write]v
and[send/recv]msg
calls, does not have an equivalent pair of functions. This makes it difficult to call, sayreadv
in such a way that you can be sure that all of the bytes have been written.If there is interest in this, I am willing to write a pull request for it.
The text was updated successfully, but these errors were encountered: