mod - Rust
Description: API documentation for the Rust `mod` keyword in crate `std`.
Keywords: rust, rustlang, rust-lang, mod

# [−]Keyword mod

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() {}
        }
    }

Run

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.