Rust: Difference between revisions
Jump to navigation
Jump to search
Line 81: | Line 81: | ||
== Bandwich == | == Bandwich == | ||
[https://github.com/imsnif/bandwhich bandwhich] | [https://github.com/imsnif/bandwhich bandwhich] | ||
== A simple guessing the number game == | |||
[https://opensource.com/article/20/12/learn-rust Learn Rust by writing a simple game] |
Latest revision as of 16:21, 3 January 2021
Install
-
Install Rust on Ubuntu 20.04 / Debian 10 and hello world example.
$ curl https://sh.rustup.rs -sSf | sh Welcome to Rust! This will download and install the official compiler for the Rust programming language, and its package manager, Cargo. Rustup metadata and toolchains will be installed into the Rustup home directory, located at: /home/brb/.rustup This can be modified with the RUSTUP_HOME environment variable. The Cargo home directory located at: /home/brb/.cargo This can be modified with the CARGO_HOME environment variable. The cargo, rustc, rustup and other commands will be added to Cargo's bin directory, located at: /home/brb/.cargo/bin This path will then be added to your PATH environment variable by modifying the profile file located at: /home/brb/.profile You can uninstall at any time with rustup self uninstall and these changes will be reverted. Current installation options: default host triple: x86_64-unknown-linux-gnu default toolchain: stable (default) profile: default modify PATH variable: yes 1) Proceed with installation (default) 2) Customize installation 3) Cancel installation > ... stable installed - rustc 1.48.0 (7eac88abb 2020-11-16) Rust is installed now. Great! To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH environment variable. Next time you log in this will be done automatically. To configure your current shell run source $HOME/.cargo/env $ source $HOME/.cargo/env $ which cargo /home/brb/.cargo/bin/cargo
Examples
Calculator + Github actions
Self hosted runners for GitHub Actions
$ cargo build --verbose $ cargo test --verbose $ rustc calculator.rs $ ./calculator expr: 5*9 result: 45