Importing Issue

I am struggling about importing a file in rust.

There is no error in the following situation.


// There is no import


mod c;


pub struct Number{}

But there is an error in file when I am tring to write "mod;" to file
Why is this happening? What is the reason of this problem? And how can I fix this?

I'm not sure exactly what your issue is, but here's a tip: before you start to break things up into files, first figure out how you want to define modules. Maybe you want something like this?

// or
mod a {
    /* ??? */

mod b {
    mod c {
        pub struct Number {}

Start with all code in the same file and modules defined in-line. Get it working that way first, and only then start breaking out modules into their own files.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.