Reduce the number of access operator

I'm new two rust I and I excuse for my stupid question. I do not even know how to search it in existing questions. Anyway I have file named A and struct A inside it. I want to use A structure and methods implemented for it in file B. But in order to do it I need to do

mod A;

but I want to do something similar to that

mod A;
use A::*;


The code from your second example should work (when correctly spelling mod).

Do not work. the "e" was typo from my side. I just test it as it now before ask my question

Can't really help you if you don't describe the problem you're facing.

The problem is that the struct and module have the same name, which prevents the struct from being imported where the module is already in scope. The standard solution is to use lowercase names for modules and capitalized names for types:

mod a {
    pub struct A;
    impl A { pub fn some_function() {} }
use a::*;

fn main() {

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.