Design of `std::stdin()`
⚓ Rust 📅 2025-12-25 👤 surdeus 👁️ 1The docs for std::io have a basic code to capture input:
let guess = String::new();
io::stdin().read_line(&mut guess)
But why wouldn't there be something like:
let guess = io::stdin().read_line()
which returns a String ? I assume there is a good reason since otherwise it'd be unnecessarily made harder.
3 posts - 3 participants
🏷️ Rust_feed