3 ms·
A comment/correction `io` is stable, its just `chars` directly on a type that implements `Read` that is still unstable, the majority of `std::io` is stable thes
by jroesch 11y ago
A comment/correction `io` is stable, its just `chars` directly on a type that implements `Read` that is still unstable, the majority of `std::io` is stable these days.
- rogual 11y agoThanks for the clarification. What's the idiomatic way to read one character from stdin?
- masklinn 11y agoThe `bytes()` iterator is stable and provides a stream of u8 (well io::Result<u8>) which is sufficient for what you want. I don't think there's a good way to decode an iterator of bytes (which bytes isn't either way, but it could be adapted) to a chars iterator at the moment.
- rogual 11y agoThank you. Bytes will do just fine. I'm glad Rust is pedantic about bytes vs. chars.
- steveklabnik 11y agoTo elaborate slightly further, char in Rust is four bytes, as it represents a Unicode Scalar Value. So the chars iterator isn't yet stable because it's not clear what should be done in the case of a read of a partial char. This is, of course, fixable, there's just a lot to do, and that's the question for this specific API.