Rust doesn’t care where you define your functions, only that they’re defined somewhere.
You can't do that in Python and JavaScript lets you do that and it does something called hoisting.
so, am a little curios, how it works in Rust Can someone explain in newbie terms
When scanning over the source it will determine what functions exist and what types they have before beginning any of the code translation work. If that step passes it will compile a whole crate at once.
You can even see this with the cargo check command, which will verify your code for validity without producing any compiled results (though it will cache the code check results).