How can I exclude importing specific module

I know we can import all the modules in a given crate using:

use crate_name::*;

or import a specific module/modules only, as:

use crate_name::module_one;
use crate_name::{module_one, module_two;

Is there a way to import everything except module_x, some thing like:

use crate_name::{* but not module_x};

I don't think there's a well-supported way to do this. One hack is to "overwrite" the imported identifier with another module of the same name:

use crate_name::*;
mod module_x {} // intentionally shadow `crate_name::module_x`
1 Like

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