|
Size: 233
Comment:
|
← Revision 8 as of 2025-10-15 16:15:38 ⇥
Size: 1384
Comment: Rewrite
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 11: | Line 11: |
| == Data Model == | == Example == |
| Line 13: | Line 13: |
| * [[Rust/Types|Types]] | {{{ fn main() { println!("Hello World!"); } }}} To compile and run the program, try: {{{ rustc hello.rs ./hello }}} It is more common to use `cargo(1)`, which wraps `rustc(1)`. It depends on the project following a standard file structure, and on being in the project's root directory. {{{ cargo build --release ./hello # or cargo run }}} The `release` flag enables all optimizations. These optimizations are also accessible with `rustc(1)`, but through multiple flags and options. ---- == Installation == The only supported method for installing and maintaining the Rust toolchain is through '''`rustup`'''. {{{ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh }}} To update the toolchain, try `rustup update`. ---- == Syntax == * [[Rust/DataTypes|Data Types]] * [[Rust/Mutability|Mutibility]] ---- == See also == [[https://doc.rust-lang.org/reference/|The Rust Reference]], the language spec [[https://doc.rust-lang.org/book/|The Rust Programming Book]], a Rust tutorial [[https://github.com/rust-lang/rustlings|rustlings]], an interactive (and `git(1)`-based) Rust tutorial |
Rust
The Rust programming language is a compiled, static-typed language built on top of the LLVM project.
Contents
Example
fn main() {
println!("Hello World!");
}To compile and run the program, try:
rustc hello.rs ./hello
It is more common to use cargo(1), which wraps rustc(1). It depends on the project following a standard file structure, and on being in the project's root directory.
cargo build --release ./hello # or cargo run
The release flag enables all optimizations. These optimizations are also accessible with rustc(1), but through multiple flags and options.
Installation
The only supported method for installing and maintaining the Rust toolchain is through rustup.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
To update the toolchain, try rustup update.
Syntax
See also
The Rust Reference, the language spec
The Rust Programming Book, a Rust tutorial
rustlings, an interactive (and git(1)-based) Rust tutorial
