Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Through cargo, external libraries are connected - crates. And you probably need modules. To do this, the files must follow a standard hierarchy. For example, like this:
There are two files in the src directory: main.rs and foo.rs
--- main.rs ---
mod foo;
use foo::*;
fn main() {
boo();
}
--- foo.rs ---
pub fn boo() {
println!("boo()");
}
If submodules are needed, then instead of foo.rs we create the foo directory, put mod.rs in it, which already contains the foo module code, and at the same time the necessary submodules are declared ( How to access one file from another in Rust? ).
Details can be found here: https://doc.rust-lang.org/book/crates-and-modules.html
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question