I\'m trying to use some Rust libraries from crates on Github. This is the first time I\'ve tried to do this. The code, lifted from an \"html\" library example, begins like t
The compiler gave you the answer you need.
Your extern crate
statements are inside a module, and use
statements require absolute paths. That is, when you say use url::Url;
inside the interactive_test
module, what you are actually saying is "use url::Url
which is defined in the root module", which it isn't.
What you need to do is prefix the path with self::
to tell it to look in the current module. You can also use super::
to access the parent module (if that ever comes up).
Personally, I get around this by putting all my extern crate
statements in the root module, which also serves as a kind of program-wide list of external crates being used.