How to use structures from sibling/adjacent rust file?

I'm trying to edit a Rust project with the following structure:



I want to call things from inside So on I added:

use iface::ip;

but it says

unresolved import `iface::ip`

no `ip` in `iface`rustc(E0432)

I also tried mod ip but it didn't work either.

In either src/iface/ or src/ add the line mod ip; Those two file locations are equivalent and function as the primary file for the iface module. The mod ip; line declares that there is a sub module ip in the iface module. I think you may have already done this.

Next try use crate::iface::ip; instead. That selects the module by the complete path relative to the crate.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.