mirror of
https://github.com/rust-lang/book.git
synced 2026-11-30 20:24:32 -06:00
@@ -104,16 +104,17 @@ Listing 2-1: Code to get a guess from the user and print it out
|
|||||||
</figure>
|
</figure>
|
||||||
|
|
||||||
This code contains a lot of information, so let’s go over it bit by bit. To
|
This code contains a lot of information, so let’s go over it bit by bit. To
|
||||||
obtain user input and then print the result as output, we need to import the
|
obtain user input and then print the result as output, we need to bring the
|
||||||
`io` (input/output) library from the standard library (which is known as `std`):
|
`io` (input/output) library into scope. The `io` library comes from the
|
||||||
|
standard library (which is known as `std`):
|
||||||
|
|
||||||
```rust,ignore
|
```rust,ignore
|
||||||
use std::io;
|
use std::io;
|
||||||
```
|
```
|
||||||
|
|
||||||
By default, Rust imports only a few types into every program in [the
|
By default, Rust brings only a few types into the scope of every program in
|
||||||
*prelude*][prelude]<!-- ignore -->. If a type you want to use isn’t in the
|
[the *prelude*][prelude]<!-- ignore -->. If a type you want to use isn’t in the
|
||||||
prelude, you have to import that type into your program explicitly with a `use`
|
prelude, you have to bring that type into scope explicitly with a `use`
|
||||||
statement. Using the `std::io` library provides you with a number of useful
|
statement. Using the `std::io` library provides you with a number of useful
|
||||||
`io`-related features, including the functionality to accept user input.
|
`io`-related features, including the functionality to accept user input.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user