Hello, I am writing an HTML parser and I am facing an issue finding a module with use
statement.
I have an issue in module resolution :
error[E0432]: unresolved import `crate::tag_path`
--> src\selectors\tag_name_html_selector.rs:8:12
|
8 | use crate::tag_path::TagPathItem;
| ^^^^^^^^ could not find `tag_path` in the crate root
The "import" statement are bellow in the file src\selectors\tag_name_html_selector.rs
use crate::elements::start_element::Tag;
use crate::selectors::format_css_request;
use crate::tag_iterator::{Elements, TagIterator};
use crate::selectors::HtmlSelectorCounter;
use crate::selectors::HtmlSelectorFindFirst;
use crate::tag_path::TagPathItem;
The src
file tree
css_selector_macro.rs
elements/
...
lib.rs
main.rs
selectors/
matcher_html_selector.rs
mod.rs
tag_name_html_selector.rs
selector_predicates.rs
tag_iterator.rs
tag_path.rs
Here are the "use" and "mod" statements :
//...
lib.rs:mod selector_predicates;
lib.rs:mod selectors;
lib.rs:mod tag_iterator;
lib.rs:mod tag_path;
lib.rs:mod elements;
lib.rs:mod css_selector_macro;
lib.rs:use tag_path::TagPathItem;
lib.rs:use elements::start_element::extract_tag_name;
lib.rs:use elements::start_element::Tag;
lib.rs:use selectors::tag_name_html_selector::TagNameHtmlSelector;
lib.rs:use selectors::HtmlSelectorCounter;
main.rs:mod elements;
main.rs:mod selectors;
main.rs:mod tag_iterator;
main.rs:use crate::selectors::tag_name_html_selector::TagNameHtmlSelector;
main.rs:use crate::selectors::HtmlSelectorCounter;
main.rs:use std::fs;
main.rs:use std::time::Instant;
selectors/matcher_html_selector.rs:use crate::elements::start_element::Tag;
selectors/matcher_html_selector.rs:use crate::selectors::HtmlSelectorCounter;
selectors/matcher_html_selector.rs:use crate::selectors::HtmlSelectorFindFirst;
selectors/matcher_html_selector.rs:use crate::tag_iterator::Elements;
selectors/matcher_html_selector.rs:use crate::tag_iterator::TagIterator;
selectors/tag_name_html_selector.rs:use crate::elements::start_element::Tag;
selectors/tag_name_html_selector.rs:use crate::selectors::format_css_request;
selectors/tag_name_html_selector.rs:use crate::tag_iterator::{Elements, TagIterator};
selectors/tag_name_html_selector.rs:use crate::selectors::HtmlSelectorCounter;
selectors/tag_name_html_selector.rs:use crate::selectors::HtmlSelectorFindFirst;
selectors/tag_name_html_selector.rs:use crate::tag_path::TagPathItem;
selector_predicates.rs:use crate::elements::start_element::Tag;
tag_path.rs:use crate::elements::start_element::Tag;
Bonus questions : It seems I cannot avoid using mod.rs files though I am running edition 2018.
[package]
name = "stream_html_selector"
version = "0.1.0"
authors = ["xxx xxxx <xxxx@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
Thank for your help.