-
Notifications
You must be signed in to change notification settings - Fork 19
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
ACP: Move std::io::Borrowed{Buf,Cursor}
into core::io
#290
Comments
We discussed this in the libs-api meeting. We have no objections! Feel free to open a tracking issue and open a PR to rust-lang/rust to add it as an unstable feature. |
Note that there's another accepted ACP that proposes to add vectored IO support for unitialized buffers: #104 |
Thanks! Filed rust-lang/rust#117693 for tracking, and sent PR rust-lang/rust#117694 for review. |
Vectored IO support and |
I think it was in the context of moving io::Error to core the team decided that it's ok to have target-specific type declarations in core. So iovec would then also have to exist in core if that would be needed directly on |
It was pointed out we already do have OS-specific type declarations in |
…m-ou-se Move `BorrowedBuf` and `BorrowedCursor` from `std:io` to `core::io` Tracking issue: rust-lang#117693 ACP: rust-lang/libs-team#290
…m-ou-se Move `BorrowedBuf` and `BorrowedCursor` from `std:io` to `core::io` Tracking issue: rust-lang#117693 ACP: rust-lang/libs-team#290
…m-ou-se Move `BorrowedBuf` and `BorrowedCursor` from `std:io` to `core::io` Tracking issue: rust-lang#117693 ACP: rust-lang/libs-team#290
Rollup merge of rust-lang#117694 - jmillikin:core-io-borrowed-buf, r=m-ou-se Move `BorrowedBuf` and `BorrowedCursor` from `std:io` to `core::io` Tracking issue: rust-lang#117693 ACP: rust-lang/libs-team#290
Proposal
Problem statement
I would like to do I/O in a
no_std
context, and it would be nice if I could use the standard library's existing safe abstractions for reading into an uninitialized buffer.Motivating examples or use cases
First case: compiling to WASM with
no_std
to avoid the large size and incomplete implementation ofstd
forwasm32
. I want to useBorrowedBuf
/BorrowedCursor
as part of the interface between the WASM module and the host.Second case: binaries for the Linux early boot environment (initrd), which has tight size constraints and therefore works best with
no_std
binaries that do I/O via raw syscall. I want to useBorrowedBuf
/BorrowedCursor
in the API that wrapsSYS_read
/SYS_readv
.Solution sketch
Just move the existing implementation from
library/std/src/io/readbuf.rs
intolibrary/core/src/io/
. Maybe give it a different tracking feature likecore_io_borrowed_buf
so it could be stabilized separately fromfeature(read_buf)
.It's not a big diff:
Alternatives
Do nothing?
Links and related work
rust-lang/rust#78485: Tracking Issue for RFC 2930 (feature
read_buf
)What happens now?
This issue contains an API change proposal (or ACP) and is part of the libs-api team feature lifecycle. Once this issue is filed, the libs-api team will review open proposals as capability becomes available. Current response times do not have a clear estimate, but may be up to several months.
Possible responses
The libs team may respond in various different ways. First, the team will consider the problem (this doesn't require any concrete solution or alternatives to have been proposed):
Second, if there's a concrete solution:
The text was updated successfully, but these errors were encountered: