Cannot import library from subfolder?

I'm trying to fork the Comrak crate.

I added nom = "6.1.2" under the dependencies section of the Cargo.toml, but, when I try to import a function as follows: use nom::{character::complete::alphanumeric1}} I get a "failed to resolve: maybe a missing crate nom" error.

Specifically, I'm trying to this import statement inside "src/parser/mod.rs".

Am I missing something fundamental here?

Update: I got it working by adding an extern crate nom; to the root lib.rs, but normally I don't have to do that. Not really sure what's going on here.

1 Like

Comrak doesn't specify an edition in Cargo.toml, which makes it compile as 2015, which required explicit extern crate.

https://doc.rust-lang.org/edition-guide/rust-2018/module-system/path-clarity.html#no-more-extern-crate

4 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.