23.10 Binary vs. Library Crates
- Binary crates compile into executables, typically featuring a
main.rswith afn main()entry point. - Library crates produce reusable functionality via a
lib.rsand do not generate an executable by default.
You can combine both by specifying [lib] and [bin] sections in Cargo.toml, letting you expose a library API and also provide a command-line interface.