I read the tutorial at above link, when i wrote this code in lib.rs
:
pub mod client;
mod network;
pub mod outermost {
pub fn middle_function() {}
fn middle_secret_function() {}
mod inside {
pub fn inner_function() {
::outermost::middle_secret_function();
}
fn secret_function() {}
}
}
fn try_me() {
//outermost::middle_function();
//outermost::middle_secret_function();
//outermost::inside::inner_function();
//outermost::inside::secret_function();
}
there is my lib tree:
communicator
├── Cargo.lock
├── Cargo.toml
├── src
│ ├── client.rs
│ ├── lib.rs
│ ├── main.rs
│ └── network.rs
and then cargo build, it error:
Compiling communicator v0.1.0 (/Users/netcan/Workspace/Rust/communicator)
error[E0433]: failed to resolve: could not find `outermost` in `{{root}}`
--> src/lib.rs:11:15
|
11 | ::outermost::middle_secret_function();
| ^^^^^^^^^ could not find `outermost` in `{{root}}`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0433`.
error: Could not compile `communicator`.
To learn more, run the command again with --verbose.
can someone tell me why it error...