У меня есть такая иерархия: src / main.rs
mod animals;
mod race
fn main() {
let s = animals::Animal(12.0, 1.8, 24, animals::race::white);
println!("Hello, world!");
}
src / animals / animal.rs
mod race;
pub mod animal {
pub struct Animal {
height: f64,
weight: f64,
age: u32,
raceT: race
}
}
src / animals / race.rs
pub mod race{
pub enum Race {
whit,
black,
yellow
}
}
и a имеют этот аргумент:
--> src\main.rs:1:5
|
1 | mod animals;
| ^^^^^^^
|
= help: name the file either animals.rs or animals\mod.rs inside the directory "src"
error: aborting due to previous error
Как правильно добавлять модули, чтобы не было ошибок