Hi,
Is it possible to import module syntax
main.rs
foo/a.rs
foo/bar/b.rs
in main.rs
import foo/a
import foo/bar/b as b
Hi,
Is it possible to import module syntax
main.rs
foo/a.rs
foo/bar/b.rs
in main.rs
import foo/a
import foo/bar/b as b
What do you mean by import module syntax
?
Sub-module in the same crate is declared via mod foo
. And importing its contents is done via use foo::bar
.
See Crates and Modules for details.
I suggest that instead of use, mod, extern crate, lib.rs, mod.rs simply use import, like ะก
TL;DR: there will be no import
. use
for import symbol, mod
for declaring that there's a module.
You seem to confuse several things.
#include
via preprocessorextern crate
mod
construct does not import anything, but instead declares that current crate will be compiled with specified module or submoduleuse
is a unified way to import any symbol into current scope, regardless of whether it's from other crate, submodule etc.