educative.io

Use prelude twice?

in the first snippet line 10 says: use prelude::*;

and the 2nd snippet line 1 says: use crate::prelude::*;

this seems to be the same thing or do i miss something here?


Course: Hands-On Game Development with Rust - Learn Interactively
Lesson: Organizing Imports with a Prelude - Hands-On Game Development with Rust

Hi @Karsten_Fuhrmann_par, Thanks for reaching out to us.

  • Use the use prelude::* to make it available to the main scope in main.rs.

  • Use the use crate::prelude:: to access the root of the tree, main.rs

So, they both are not the same.

Hope it will help, Happy Learning :slight_smile:

1 Like