Rust

From Rixort Wiki
Revision as of 16:37, 2 July 2019 by Paul (talk | contribs) (→‎Cargo)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Cargo

cargo new [name] creates a new library.

cargo new [name] --bin creates a binary.

By default, cargo new initialises a Git repository with a .gitignore file.

Configuration is stored in Cargo.toml.

cargo build will build the executable, only if the source files have changed (similar to Make).

cargo run will build (if necessary) and then run the executable.

Notes

  • Rust style is to indent with four spaces, not a tab.
  • If a function call ends with !, it is a macro rather than a function.