How do you get rust to recognize a module within a crate? I believed it was enough to declare mod [module name]
in lib.rs
. Is it not?
Error:
error[E0432]: unresolved import `crate::a`
--> src/bin/b.rs:2:12
|
2 | use crate::a::f;
| ^ could not find `a` in the crate root
src/a.rs
:
pub fn f() {}
src/bin/b.rs
:
use crate::a::f;
fn main() {}
src/lib.rs
:
mod a;
Cargo.toml
:
[package]
name = "m"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[[bin]]
name = "b"
path = "src/bin/b.rs"
[dependencies]