From JS to Rust

Rocket turtles to crustaceans

Node.js mascot Rust mascot

Probably even more important than its features is the ecosystem and the community behind the language. Rust really shines here - especially for people who love the web.

@donaldpipowitch

How?

use std::io;

fn main() {
    println!("Please input the temperature in Celsius.");

    let mut temperature = String::new();
    io::stdin().read_line(&mut temperature)
            .expect("Failed to read line");


    let temperature: f32 = temperature.trim().parse()
        .expect("Please type a number!");

    println!("{}", (temperature * 9.0) / 5.0 + 32.0);
}

Why?

I love Rust because it reduces bugs by targeting it's biggest source... me.

@ObliviousJD

The package

Rust

JavaScript

  • n, nvm?
  • npm - npmjs.com
  • npm init
  • prettier
  • eslint
  • tape, ava, jest?
  • runtime provided library
  • Promises

Who?

Mozilla logo

Please let me code

Install

curl https://sh.rustup.rs -sSf | sh

Remove

rustup self uninstall
cheats.rs

Conclusion

  1. doc.rust-lang.org/book/
  2. exercism.io/tracks/rust
  3. github.com/Mercateo/rust-for-node-developers