Being an intermediate Rust programmer in one day

By Edward Li

As an Amazonian, writing 6 pagers is what I do almost every day. The beauty of 6 pagers is it allows you to focus on problems you are going to solve with a neat structure. So within this blog, I’m gonna leverage a typical 6 pagers template to explain how to become an intermediate Rust programmer in one day. Read this blog to know more about 6 pagers.

#1 I was told Rust has a steep learning curve even for people have C/C++ programming experience like me. Is that true?
 #2 If it’s not true, how to become a Rust programmer in a short time?

intro_rust() is a fantastic website for Rust beginners to understand what make Rust different with other programming languages e.g. C++, Java and Python.
 Takeaways:

  1. Rust is a systems programming language with a focus on safety, especially safe concurrency.
  2. Concept of ownership, shared borrows and mutable borrows

By watching videos in Rust Programming Tutorials presented by decode will give you basic understanding on how Rust code looks like. You can quickly map Rust syntax to programming languages you are familiar with. Feel free to speed up when watching the videos.
 Takeaways:

  1. cargo and package management
  2. OOP with leveraging struct, impl and traits in Rust
  3. scopes & lifetime
  4. match
  5. option
  6. I/O basics

Watch this video(Rust Concurrency Explained) to familiar yourself with concurrency programming in Rust which is most important feature Rust brings. Rust provides library-based concurrency features. All the language provides are ownership and borrowing.
 Takeaways:

  1. std::thread allows a thread spawn child threads. Read manual to understand move closure.
  2. ARC (Atomically Reference Counted) allows program to share read-only memory between threads.
  3. std::sync::Mutex uses Mutex to explicitly acquire lock before mutating shared memory.
  4. std::sync::automic provides a bunch of lock-free functions which is way light-weight than using Mutex
  5. std::thread::mpsc is a memory FIFO queue which allows multiple senders and one single receiver
  6. rayon A 3rd-party data parallelism library for Rust
  7. crossbeam epoch-based garbage collection
  8. tokio — A run time for writing reliable, asynchronous, and slim applications with the Rust programming language.

Great! You are all set for practicing! Find some open-source projects to read and write!
 I want high-light some:

  1. aws-lambda-rust-runtime
  2. rayon
  3. tikv

Based on my learning experience, I don’t think Rust has an extremely steep learning curve. I managed to understand Rust and do some exercises in one day. In my opinion Rust is way more developer friendly programming language than any other systems programming language. It offers confident, productive systems programming.
 
 Trade-off between compiling efficiency and safety made within Rust is really smart. With the features Rust offered, compiling is relatively time-consuming than C++ and Java. It makes sense to me, all developers need to do is to have a powerful dev desktop to be more productive. 
 
 Based on 3 party libraries developed in the ecosystem, developers can leverage Rust for application software development as well.

  1. Sunday, December 23 Initial version