A Tasty Treats Podcast for Web Developers.

Ask a Potluck Question β†’
Wes Bos

Wes Bos

Full Stack JavaScript Developer. Creator of really good web development courses. BBQ enthusiast.

Scott Tolinski

Scott Tolinski

Web Developer, Creator of Level Up Tuts, Bboy, Robotops Crew and Youtuber

Playing: 657: Rust for JS Devs β€” Part 2

0:00

LOUDNESS

Aug 23rd, 2023

Rust for JS Devs β€” Part 2

πŸ‘‡ Download Show✏️ Edit Show Notes

In this episode of Syntax, Wes and Scott jump into part 2 of their look at Rust for JavaScript developers, including variables in Rust, type systems in Rust, signed and unsigned integers, and more.

Show Notes

let x = 5;  // x is immutable
let mut x = 5; // x is mutable
const MAX_POINTS: u32 = 100_000; // must be defined at compile time
let unsigned_value: u8 = 200;
let signed_value: i8 = unsigned_value as i8;
struct User {
   username: String,
    email: String,
    sign_in_count: u64,
    active: bool,
}

// You can create an instance of a struct like this:
let user1 = User {
    email: String::from("someone@example.com"),
    username: String::from("someusername123"),
    active: true,
    sign_in_count: 1,
};

impl User {
    fn login(&mut self) {
        self.login_count += 1;
    }
}
  • 49:17 SIIIIICK Γ—Γ—Γ— PIIIICKS Γ—Γ—Γ—

Γ—Γ—Γ— SIIIIICK Γ—Γ—Γ— PIIIICKS Γ—Γ—Γ—

Shameless Plugs

Tweet us your tasty treats