diff options
Diffstat (limited to 'mingling_pathf/src/pattern_analyzer.rs')
| -rw-r--r-- | mingling_pathf/src/pattern_analyzer.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/mingling_pathf/src/pattern_analyzer.rs b/mingling_pathf/src/pattern_analyzer.rs index 5b25c15..e88d9f6 100644 --- a/mingling_pathf/src/pattern_analyzer.rs +++ b/mingling_pathf/src/pattern_analyzer.rs @@ -50,6 +50,8 @@ pub struct AnalyzeItem { pub item_name: String, /// Whether the item is from an external crate (resolved via `use`), bypassing the file's own module path. pub is_foreign: bool, + /// When `true`, this item is a module whose contents should be glob-imported (`::*`). + pub is_module: bool, } impl AnalyzeItem { @@ -59,6 +61,17 @@ impl AnalyzeItem { module, item_name, is_foreign: false, + is_module: false, + } + } + + /// Creates a local module item — generates a `use path::item_name::*;` glob import. + pub fn local_module(module: String, item_name: String) -> Self { + Self { + module, + item_name, + is_foreign: false, + is_module: true, } } @@ -68,6 +81,7 @@ impl AnalyzeItem { module, item_name, is_foreign: true, + is_module: false, } } } |
