April 2026
Intermediate
631 pages
16h 20m
English
In this section, we’ll provide some practice questions to help reinforce your learning. The exercise questions cover almost all the concepts introduced in the chapter. Solutions to each exercise will follow in Section 6.8.
Fixing visibility issues in nested modulesFix the code so that it compiles correctly. The code consists of nested modules with a struct and an enum. The goal is to ensure that the struct A in module m1 can access the enum D defined in module m2.
mod m1 { struct A { d: m2::D, } mod m2 { enum D { B, C, } }}fn main(){}
Resolving module visibility and path issuesFix the code so that it compiles correctly. The code involves nested modules with a structure and an enum in m1, and another structure in ...
Read now
Unlock full access