I have a small educational project on Rust.
I decided to add performance measurements and ran into a problem - error[E0432]: unresolved import.
Project tree:
src\
main.rs
src\benches\
mod.rs
benchmarks.rs
src\easy\
mod.rs
task_00001.rs
main.rs:
extern crate criterion;
pub mod easy;
pub mod benches;
struct Solution;
fn main() {
}
src\benches\mod.rs:
pub mod benchmarks;
src\benches\benchmarks.rs:
use crate::Solution;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
pub fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("count_largest_group 9999", |b| b.iter(|| Solution::count_largest_group(black_box(9999))));
}
criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);
And after cargo bench
i have error:
error[E0432]: unresolved import `crate::Solution`
--> src/benches/benchmarks.rs:1:5
|
1 | use crate::Solution;
| ^^^^^^^^^^^^^^^ no `Solution` in the root
Why this code working in src\easy\task_00001.rs, but didn't working here?