I use following file structure:
├── src
│ ├── main.rs // Macros from here
│ ├── models
│ │ ├── mod.rs // Loads the user.rs file
│ │ └── user.rs // Should be visible here
├── Cargo.toml
My main.rs
file imports the stuff like:
#[macro_use]
extern crate mongodb;
mod models;
My user.rs
file looks like:
pub struct User {
username: String,
password: String,
}
impl User {
fn create_doc() {
// Some code, but doc! from crate mongodb is not in this scope.
}
}
How can I use my doc!
macro in the user.rs
file? I also tried to add #[macro_use]
to the stuff like mod models;
, but nothing worked.