Keyword use[][src]

Import or rename items from other crates or modules.

Usually a use keyword is used to shorten the path required to refer to a module item. The keyword may appear in modules, blocks and even functions, usually at the top.

The most basic usage of the keyword is use path::to::item;, though a number of convenient shortcuts are supported:

Using path qualifiers like crate, super or self is supported: use crate::a::b;.

Note that when the wildcard * is used on a type, it does not import its methods (though for enums it imports the variants, as shown in the example below).

enum ExampleEnum {

impl ExampleEnum {
    fn new() -> Self {

use ExampleEnum::*;

// Compiles.
let _ = VariantA;

// Does not compile !
let n = new();

For more information on use and paths in general, see the Reference.

The differences about paths and the use keyword between the 2015 and 2018 editions can also be found in the Reference.