Rust: Difference between revisions
Jump to navigation
Jump to search
Created page with "Category:Programming" |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Cargo == | |||
<code>cargo new [name]</code> creates a new library. | |||
<code>cargo new [name] --bin</code> creates a binary. | |||
By default, <code>cargo new</code> initialises a Git repository with a <code>.gitignore</code> file. | |||
Configuration is stored in <code>Cargo.toml</code>. | |||
<code>cargo build</code> will build the executable, only if the source files have changed (similar to Make). | |||
<code>cargo run</code> 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 <code>!</code>, it is a macro rather than a function. | |||
[[Category:Programming]] | [[Category:Programming]] |
Latest revision as of 15:37, 2 July 2019
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.