How can I use a module from outside the src folder in a binary project, such as for integration tests or benchmarks?

Viewed 6117

My project's path structure is as follows:

demo
├── benches
│   └── crypto_bench.rs
├── src
│   ├── main.rs
│   └── crypto.rs
├── Cargo.lock
└── Cargo.toml

crypto.rs contains a struct Crypto with implementation. crypto.rs is referred to from main.rs using mod crypto;

How can I use crypto.rs from crypto_bench.rs inside the benches folder?

I have tried all kinds of variations of extern crate, mod, super and use. All examples I could find online are for library projects with a lib.rs and those "imports" don't work when using a project with a main.rs file.

1 Answers
Related