Ultimate Rust Crash Course !!exclusive!! Online
for i in &v2 { println!("{}", i); } struct Point<T> x: T, y: T,
fn add(a: i32, b: i32) -> i32 a + b // no semicolon -> this is returned
For quick prototyping: unwrap() or expect() (panics on error).
let f = File::open("hello.txt").unwrap(); let f = File::open("hello.txt").expect("Failed to open hello.txt"); Propagate errors with ? operator (inside function returning Result ):
Congratulations. You now speak enough Rust to be dangerous. Go write some safe, fast code. 🦀
for i in &v2 { println!("{}", i); } struct Point<T> x: T, y: T,
fn add(a: i32, b: i32) -> i32 a + b // no semicolon -> this is returned
For quick prototyping: unwrap() or expect() (panics on error).
let f = File::open("hello.txt").unwrap(); let f = File::open("hello.txt").expect("Failed to open hello.txt"); Propagate errors with ? operator (inside function returning Result ):
Congratulations. You now speak enough Rust to be dangerous. Go write some safe, fast code. 🦀