-2

I'm trying to import a function present in a file named 'utils.rs' into a file named 'input.rs', but I'm getting the following error:

error[E0583]: file not found for module `utils`
 --> src/input.rs:5:1
  |
5 | mod utils;
  | ^^^^^^^^^^
  |
  = help: to create the module `utils`, create file "src/input/utils.rs" or "src/input/utils/mod.rs"

error[E0432]: unresolved import `utils::rev_compl`
 --> src/input.rs:6:5
  |
6 | use utils::rev_compl;
  |     ^^^^^^^^^^^^^^^^ no `rev_compl` in `input::utils`

The structure of my directory src is:

main.rs
input.rs
process.rs
output.rs
utils.rs

I'm calling the function this way (top of input.rs file):

mod utils;
use utils::rev_compl;

And the function 'rev_compl' in the utils.rs file contains the 'pub' prefix:

pub fn revcompl(seq: &str) -> String {

Does anyone know how to solve this error? Thanks for your help!

Romain
  • 137
  • 2
  • 9
  • Look at the directory structure in [this answer`](https://stackoverflow.com/a/76336830/11527076). (the error messages you got gave useful hints for this) – prog-fh Aug 20 '23 at 09:07
  • The error messages given by the Rust compiler are especially crafted to give you as much useful info as possible it tells you specifically where it looked for a file "src/input/utils.rs" and "src/input/utils/mod.rs" your file is neither of those... – cafce25 Aug 20 '23 at 09:21
  • Thanks a lot! It does solve my issue. My apologies for not spotting this previous question. – Romain Aug 20 '23 at 09:25

0 Answers0