Skip to main content Link Menu Expand (external link) Document Search Copy Copied

CS61B, but in Rust

By Samuel Berkun

This is a collection of assignments for CS61B in Rust.

Why Rust?

Java is bad. Rust is good. Duh.

Really, why Rust?

Let’s begin with the downsides. Rust has an extremely steep learning curve, which means that you’ll need to learn a lot to write even basic programs. Tasks that are easy in Java can often be difficult in Rust, so these assignments are much more challenging than their Java equivalents.

Overall, Rust demands a lot more from you as a programmer. But in return, you get:

  • blazingly fast performance
  • a wide range of use cases, from GUIs to high-performance computing to embedded systems
  • great tooling and documentation
  • virtually bug-free code

That last point may sound too good to be true. How can a programming language prevent bugs? The secret is Rust’s ownership model and strong type system, which makes entire classes of bugs simply impossible. Ever run into a NullPointerException, ConcurrentModificationException, or ClassCastException? All of these are impossible in Rust.

If “not having bugs” seems appealing to you, I highly recommend giving the language a try. It really is greener on this side of the fence.

How do I start?

If you’re new to Rust, I recommend checking out the book and Rust by Example, which are both comprehensive introductions to the language. If you just want to learn some basics and jump into the assignments, you can check out this website’s crash course and begin working on lab 1.

Resources

Course materials: