There’s a Newline in Stdin, Watch Out! (Rust)
Nov 2 · 4 min read
On my journey through the brain gymnasium that is the Rust programming language, newlines have made for some intense brain workouts. You can read about my first experience with the newline character playing tricks on me here. The issue in that post was caused by stdout flushing when it sees a newline. This post has to do with stdin’s newline character messing up a type conversion.
The Broken Code
use std::io::stdin;fn main() { let mut s = String::new();

