Use neighbour module without calling parent's crate?

Hello everyone!

I'm dealing with module hierarchy. I have:


With exposing module content:

mod foo;

pub use foo::do_something;

So I use ecs content in with:

mod ecs;
use crate::ecs;



Now I want to use content in

My only working solution is to add bar as mod:

mod foo;
mod bar; // declared here

pub use foo::do_something;

And use it in like this:

use crate::ecs::bar;

pub fn do_something() {

My problem is about giving the whole path:

use crate::ecs::bar;

I would like something that doesn't depends on full ecs path. A python-ish way would be:

use .bar;
use crate::.::bar;

ecs module is a black box, internals shouldn't even known its name.

So, how or could use each other without having to specify the parent module name? What am I missing?

Thanks in advance! :slight_smile:

use super::bar;


Thanks, it's crazy I didn't found it depicts searching for this. :heart:

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