std::io: vectored reads with uninitialized memory (Read::read_buf_vec) #104
Labels
ACP-accepted
API Change Proposal is accepted (seconded with no objections)
api-change-proposal
A proposal to add or alter unstable APIs in the standard libraries
T-libs-api
Proposal
This is an implementation of part of RFC 2930 (read_buf) which was not deeply specified in the RFC
Problem statement
Implement Read::read_buf_vec.
Motivation, use-cases
Vectored IO without having to initialise all the buffers first.
Solution sketches
This mostly follows BorrowedBuf/BorrowedCursor, extended to slices for vectored IO. We need a new version of IoSliceMut which does not assume that all data in it is initialised. Note that this is an improvement over the read_vec API because the underlying buffers can be reused.
An alternative would be to use the old single buffer design, but this has problems with a complex API and a soundness footgun. We could also pass a slice of BorrowedCursors, but this is pretty horrible ergonomically.
Links and related work
Draft PR with incomplete implementation: rust-lang/rust#101842
The text was updated successfully, but these errors were encountered: