Organize code into modules.
Use mod
to create new modules to encapsulate code, including other modules:
mod foo { mod bar { type MyType = (u8, u8); fn baz() {} } }
Like struct
s and enum
s, a module and its content are private by default, unaccessible to code outside of the module.
To learn more about allowing access, see the documentation for the pub
keyword.
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/keyword.mod.html