Where is "use crate::" documented?

I'm reading code that involves

use crate::.......

I can't figure out what this code is doing, and I'm having problem googling for "use crate".

Can someone link me to where this is documented?

1 Like


1 Like

I came across your post as the second search result for [use crate] (I was looking for the same thing). I wanted to add, for future visitors, that there is detailed documentation available at https://doc.rust-lang.org/reference/items/use-declarations.html#use-paths:

Paths in use items must start with a crate name or one of the path qualifiers crate , self , super , or :: . crate refers to the current crate.

1 Like

Another useful page is from the Rust Book, "Paths for Referring to an Item in the Module Tree" which includes examples for crate and other common ways to reference items in other modules.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.