Using ES modules in JavaScript, you would import something into a module like so:
import thing from "stuff";
We can achieve similar behavior with Rust types using the use
keyword. In the example below, we're importing io
from std
.
use std::io;
fn main() {
let mut guess = String::new();
io::stdin()
.read_line(&mut guess)
.expect("Failed to read line");
println!("{}", guess);
}