- A nice alternative to C++
- Compiles to native programs ๐
- Has the very nice package manager Cargo
- ๐ https://github.com/tgotwig/vidmerger
- ๐ https://github.com/TGotwig/cardio/blob/master/rust-cardio/src/main.rs
- ๐ฆ https://lib.rs/crates/rustscan
- ๐ท rust-unofficial/patterns#90 (formated)
- ๐ 1.0 released in 15.05.2015
- ๐คฉ Powerful extension for VSCode
- ๐ง In the Linux cernel is Rust code linus-torvalds-weighs-in-on-rust-language-in-the-linux-kernel
- ๐ Many high level functions available
- ๐ถ Cross compiling is more or less easy
- ๐ You can write an operating system with Rust https://www.redox-os.org
- ๐ค Automatic code generation from swagger file https://openapi-generator.tech/docs/generators
- ๐ฎ Memory safety: Forces you to fix unsafe code
- ๐ Can boost web applications via WebAssembly
- ๐ Very good documentation, always a code example
- ๐ค A very smooth and active forum where you can ask questions https://users.rust-lang.org
- ๐คฏ Metaprogramming (Macros) which are functions with additional powers: inline_python, serde_json
โ๏ธ Java | ๐ฆ Rust |
---|---|
Maven | Cargo |
Checkstyle | Clippy |
class | impl |
List | Vec |
interface | struct / trait |
Lambda | Closure |
switch case | match |
Rust has no new
keyword, you have to have a function which is called new
inside of an impl
thing:
struct Sheep {/* bunch of field signatures */}
// basically an interface for fieldstrait Animal {/* bunch of method signatures */}
// basically an interface for methods, can also contain implementationsimpl Sheep {/* bunch of methods with the fields from struct */}
// from that you can create an object:Sheep::new("Dolly");
// would need implementation fornew
impl Animal for Sheep {/* implemented methods from Animal */}
// ImplementsAnimal
trait forSheep
:let mut dolly: Sheep = Animal::new("Dolly");
from https://doc.rust-lang.org/rust-by-example/trait.html
Drops say
after calling print_out/1
:
fn main() {
let say = String::from("Cat");
print_out(say);
println!("Again: {}", say); // ERROR
}
fn print_out(to_print: String) {
println!("{}", to_print);
}
Returns say
after calling print_out/1
:
fn main() {
let say = String::from("Cat");
print_out(&say);
println!("Again: {}", say);
}
fn print_out(to_print: &String) {
println!("{}", to_print);
}
Sometimes the compiler says what to do to fix a problem:
24 | let format_args: &str = match matches.value_of("format") {
| _____________________________^
25 | | Some(x) => x,
26 | | None => "avchd,avi,flv,mkv,mov,mp4,webm,wmv",
27 | | };
| |_____^ help: replace with: `matches.value_of("format").unwrap_or("avchd,avi,flv,mkv,mov,mp4,webm,wmv")`
- Videos
- Hello Rust! // funny tutorial ๐
- Beginner's Series to: Rust // 35 small videos from Microsoft from 06.2021
- Programmieren in Rust // lectures from university
- Jon Gjengset // Long and advanced videos, multiple hours long
- Rust's Journey to Async/Await // Rust creator about Async/Await