Skip to content
← All tracks

Modules, Visibility, Testing and Docs

Rust

Structure, encapsulation and verification. The generated `main()` sits outside your modules, so under-exposure fails to compile and over-exposure trips a lint — architecture, graded.

This track is written for Rust, which isn't the mode you're browsing in.

0 / 17 solved · 5 articles
  1. 1. Not solved yet. Modules are a tree you declare, not files you discover
  2. 2. Not solved yet. Paths: absolute, relative, crate::, self::, super::
  3. 3. Not solved yet. Everything is private by default: the two privacy rules
  4. 4. Not solved yet. Restricted visibility: pub(crate), pub(super), pub(in path)
  5. 5. Not solved yet. use declarations: nested groups, as, self, and _
  6. 6. Not solved yet. Glob imports, shadowing, and ambiguity
  7. 7. Not solved yet. Three namespaces: types, values, and macros
  8. 8. Not solved yet. pub use re-exports and the facade pattern
  9. 9. Not solved yet. The preludes — all five of them
  10. 10. Not solved yet. macro_rules! scoping is not item scoping
  11. 11. Not solved yet. Module file layout: foo.rs, foo/mod.rs, and #[path]
  12. 12. Not solved yet. #[cfg], cfg!, cfg_attr and the new cfg_select!
  13. 13. Crate vs package vs workspace vs module Read
  14. 14. `Cargo.toml` essentials Read
  15. 15. Not solved yet. Version requirements: caret, tilde, wildcard, pre-releases
  16. 16. Not solved yet. Cargo features and the additivity rule
  17. 17. Not solved yet. SemVer for Rust APIs: what actually breaks
  18. 18. Workspaces, publishing, MSRV and docs.rs Read
  19. 19. `#[test]`, the assert macros, and what a test actually is Read
  20. 20. Not solved yet. Build your own #[test]: catching panics deterministically
  21. 21. Unit tests, `#[cfg(test)]`, integration tests and the lib+bin split Read
  22. 22. Not solved yet. Test selection: filters, #[ignore], and the libtest CLI

Check yourself

4 questions · one attempt each

These do not count toward finishing the track. They are here to catch the things that are easy to read past.

0 / 4

How does a test in tests/api.rs differ from one in #[cfg(test)] mod tests?

src/lib.rs   ->  #[cfg(test)] mod tests { ... }
tests/api.rs ->  use my_crate::...;
Question 1 of 4