I'm trying to define the crate going along with my Rust application as explained in the documentation. Let's take the following directory structure:
src/
├─ lib.rs
├─ main.rs
└─ myapp/
├─ a/
│ ├─ a1.rs
│ └─ mod.rs
└─ mod.rs
Now I defined the following in my rust files:
lib.rs
pub mod myapp;
main.rs
extern crate myapp;
use myapp::a;
fn main() {
unimplemented!();
}
myapp/mod.rs
pub mod a;
myapp/a/mod.rs
pub use self::a1::*;
mod a1;
myapp/a/a1.rs
pub fn myfunc()
{
unimplemented!();
}
If I try to compile the above directory tree, I got the error:
$ cargo build
Compiling myapp v0.1.0
src/main.rs:2:5: 2:13 error: unresolved import `myapp::a`. There is no `a` in `myapp` [E0432]
src/main.rs:2 use myapp::a;
^~~~~~~~
src/main.rs:2:5: 2:13 help: run `rustc --explain E0432` to see a detailed explanation
error: aborting due to previous error
Could not compile `myapp`.
Where am I wrong here? I think I have the same directory structure as the one shown in the documentation.