November 2017
Intermediate to advanced
264 pages
5h 45m
English
The next error the compiler throws at us is error: Zombie does not name a structure; clearly the code for the Zombie struct is not found. Because this struct also resides in the monsters module, the solution is easy: prefix Zombie with monsters::, like this:
let zmb1 = monsters::Zombie {health: 75, damage: 15};
Another error: struct `Zombie` is private makes it clear that we must mark the Zombie struct with pub like the following:
pub struct Zombie { ... }
Now we get an error on the line containing zmb1.noise():error: type `monsters::Zombie` does not implement any method in scope named `noise`. The accompanying help note explains what to do and why:
help: methods from traits can only be called if the trait is ...
Read now
Unlock full access