Live data from Hacker News

Rust Lang in a nutshell

softax.pl

1–10 of 36 posts

Re: Rust Lang in a nutshell

#3

  let s1 ="hello world";
  let s2 = s1; // copied – x1 is still valid
  let x1 = 2;
  let x2 = x1; // copied – x1 is still valid

  println!("{} for the {}nd time!", s1, x1);
Typo in first comment? s1 vs x1?

Re: Rust Lang in a nutshell

#4
post #3

let s1 ="hello world"; let s2 = s1; // copied – x1 is still valid let x1 = 2; let x2 = x1; // copied – x1 is still valid println!("{} for the {}nd time!", s1, x1); Typo in first comment? s1 vs x1?

fixed, thank you

Re: Rust Lang in a nutshell

#5
Example for skipping return keyword in case of early return is just wrong. It can be made to work if you have if x > 0 { x } else { x + 1 } but then it isn't early return anymore.

Re: Rust Lang in a nutshell

#9
This seems like a fairly gentle introduction. I will definitely consider it as a starting point for more junior developers interested in touching our Rust code.

For those with more experience, Rust By Example walks through the same concepts in a more compact form that also lets you experiment with the code in your browser: https://doc.rust-lang.org/rust-by-example/index.html

Re: Rust Lang in a nutshell

#10
post #6
post #2

See also, https://doc.rust-lang.org/book/title-page.html

I tend to like "Learn X in Y minutes" for a quick overview of common syntax / constructs. https://learnxinyminutes.com/docs/rust/

I have written down the summary of the Rust book when I was learning and going through the book: https://github.com/psibi/rust-book-summary

It's much denser than "Learn X in Y minutes" but it covers more.

Post reply on HN