Hey all.
I’m not sure of this suggestion is a breaking change, but if it is, it’s pretty minor and can be bundled in the 2018 Edition.
I think it is a good idea to lower the Read/Write traits into libcore.
Embedded applications still perform IO (as any application does, I guess), and having the traits to support it can help standardize the interface.
If I want to write a library that abstracts over Read, it is now automatically requires stdlib, even though all I use is a couple of traits. This requires me to write an identical trait in my crate, but it will never compose ergonomically with the ones defined in stdlib or with libraries using it.
Having the traits in std also prevents nostd applications from using a simple functionality of &[u8]; read()
& write()
.
This concern has spawned https://github.com/QuiltOS/core-io (which is unmaintained AFAIK).
Lowering the traits into libcore might absolutely causes breakage though, as even the most basic traits in std::io
depend on liballoc:
-
std::io::error::Repr
has a variantCustom
which contains aBox<Error>
-
std::io::Read
hasread_to_end
andread_to_string
, which depend onVec<u8>
andString
, respectively.
I don’t think Rust currently has the mechanisms needed in order to support this change without breaking compatibility, but I would love to hear if anyone has any idea if it’s achievable.