I Have a simple library project in Rust.
The root's lib.rs
:
mod account_library;
mod error_handler;
mod record_library;
pub use account_library::*;
pub use error_handler::*;
pub use record_library::*;
the /account_library/mod.rs
:
/// Very simple struct about an enum.
/// How to use:
/// ```
/// # use crate::account_library::AccountSide;
/// let side = AccountSide::Debet;
/// ```
#[derive(Deserialize, Serialize)]
pub enum AccountSide {
Debet,
Kredit,
}
The problem is whenever I run the cargo test
command, the rust compiler can't find the AccountSide
Enum that I declared just right below the comment. It's in the same file.
error[E0432]: unresolved import `crate::account_library`
--> src\account_library\mod.rs:42:12
|
3 | use crate::account_library::AccountSide;
| ^^^^^^^^^^^^^^^ could not find `account_library` in the crate root
Here's what I've tried so far:
/// # use crate::AccountSide; <---- no `AccountSide` in the root
/// # use AccountSide; <---- no external crate `AccountSide`
Removing the # use
also doesn't work
So what's wrong here ? and how to make this enum
or any struct
available inside the doc?