extern crate foo indicates what you want to link to the external library, and enters the name of the top-level box into the scope ( use foo ). Starting with Rust 2018, in most cases, you will no longer need to use extern crate , because Cargo informs the compiler about the presence of boxes. (There are one or two exceptions )
use bar is a shorthand for referring to fully qualified characters.
Theoretically, the language does not need use - you can always just fully qualify the names, but entering std::str::String.new(...) will be very tedious! Instead, you can simply type use std::str::String once, and then String will refer to it. (the use statement for String is part of the prelude, so you usually don't see this)
source share