Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
use std::io::{self, Read}; | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
fn main() { | ||
println!("Hello, world!"); | ||
for b in io::stdin().bytes() { | ||
This comment has been minimized.
Sorry, something went wrong.
pflenker
Owner
|
||
let c = b.unwrap() as char; | ||
println!("{}", c); | ||
This comment has been minimized.
Sorry, something went wrong.
pflenker
Owner
|
||
} | ||
} |
In layman's terms, this line tells rust: "From the Standard Library (
std
), I want to use Input and Output stuff (io
)".This line is a shorthand for:
We will use
io
below, but we won't useRead
, so why import it here?In short, it's a Trait, something we will revisit a bit later.
In a nutshell,
Read
brings the implementation forbytes
with it. Try removing it and see what happens.