Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Rust main function

  • fn

  • main

  • There are two types of crates: libraries and executables. The latter can also contain libraries.

  • For executable crates we must have a file called src/main.rs and it must have a function called main.

  • This is the most basic definition of a main function. It does nothing.

fn main() {}