From High-Level to Systems Programming: A Practical Guide to Rust

Maybe your language of choice is…

Maybe your language of choice is…

Maybe your language of choice is…

And now you want to learn Rust How do you start?

My journey to Rust started with…

My months leading up to the Academy…

How will you start?

1 2 Getting Started Rust Syntax 3 4 Ownership Generics

Getting Started

Major Differences

JavaScript Python Ruby ● Interpreted ● Dynamic typing ● Garbage collected ● Interpreted ● Dynamic typing ● Garbage collected ● Interpreted ● Dynamic typing ● Garbage collected

Rust ● Compiled ● Static typing ● Manual memory management

Developer Ecosystem

“Rust is on its seventh year as the most loved language with 87% of developers saying they want to continue using it.”

To name a few… Web development: Actix, Rocket, Tide Async programming: Tokio, async-std Growing ecosystem of libraries and tools Serialization: Serde Blockchain: Substrate, ink! Database ORMs: Diesel, sqlx, Cryptography and security: scale, ring, rustls GUI development: druid, iced Game development: Amethyst, Bevy, ggez

  • Regular release cycle Actively being improved and developed
  • Community-driven RFC process - Focus on ergonomics, performance and stability - Strong emphasis on backward compatibility

Cargo: Package Manager and build tool crates.io: Package registry

That’s different than Rubygems 🤔

Syntax

A Quick Look

Type System

Memory and Ownership

Memory Management

JavaScript relies on garbage collection to free memory from previous large arrays, which may introduce performance overhead. Rust deallocates memory as soon as it’s no longer needed, providing efficient and deterministic memory management.

Ownership

Once Pac-man (i.e. Rust) consumes (i.e. owns) the ball, it’s no longer available

Generics

What are generics?

Generics allow writing flexible, reusable, and type-safe code without specifying concrete data types

Create functions, structs, enums, and traits that work with multiple data types

Why use generics?

Generics provide a way to achieve flexibility similar to dynamically typed languages while maintaining type safety benefits of static typing

Generics Syntax

It’s Reusable!

Continue Your Learning

Maybe you heard about the Rust book before…

Have you heard about the Brown University version?

https://rust-book.cs.brown.edu/

Rustlings github.com/rust-lang/rustlings

Intro to Rust Course

https://w3f.github.io/w3f-education/docs/introrust

Streaming every week!

Learning Rust from isn’t always easy

But, with the right resources and community it is possible!

Let’s keep learning Rust together!