mod some_mod;
use some_mod::*;
pub fn main() {
let foo_animal = Animal::Cat(Cat);
println!("{}", foo_animal.shout("BAR"));
}
The above minimal example fails to compile and I couldn't figure out how to get it to work using #[macro_use], I fixed it by placing the trait definition above the enum definition in some_mod.rs. So the following does compile:
Relates to https://github.com/hobofan/ambassador/issues/19, it seems the order of definitions matter if inside the same module file?
some_mod.rs
main.rs
The above minimal example fails to compile and I couldn't figure out how to get it to work using
#[macro_use]
, I fixed it by placing the trait definition above the enum definition insome_mod.rs
. So the following does compile:some_mod.rs