|
| 1 | +--- |
| 2 | +title: Rust 🦀 |
| 3 | +description: "Rust is a performant, strongly typed language. This post covers why I chose to learn it, and some stuff I've made with it." |
| 4 | +date-published: 2025-01-31 |
| 5 | +template: post.template.html |
| 6 | +tags: |
| 7 | + - rust |
| 8 | + - adventofcode |
| 9 | + - wasm |
| 10 | + - webassembly |
| 11 | + - javascript |
| 12 | +--- |
| 13 | + |
| 14 | +# Rust 🦀 |
| 15 | + |
| 16 | +For some time I've wanted to learn a performant, strongly typed, low-level language, and in 2024 I decided that language is [Rust][rust-lang]. |
| 17 | + |
| 18 | +I've chosen Rust as it's different enough from JavaScript, both in terms of how it's written and how it's used, yet it can also interoperate with JS via [WebAssembly][wasm]. So it's something new, but it can also serve my core competency. |
| 19 | + |
| 20 | +I've been bothered for a while by TypeScript. I'm not sure where it fits. I think JavaScript still has its place as the default way websites are augmented with code. I believe TypeScript seeks to address perceived shortcomings of JS in ways that are better addressed by other tools like WASM, and by continuing to iterate upon JS directly. |
| 21 | + |
| 22 | +The way I figure it, I can maximise the benefits of types using a language built with them in mind from the ground up. A language that isn't held back by what it must compile down to. I could go on at length about this, but this post is supposed to be about Rust. |
| 23 | + |
| 24 | +I want this post to act as the hub for all the Rust projects I have worked on and what I'm working on at the moment. |
| 25 | + |
| 26 | +## Advent of Code 2024 🎄 |
| 27 | + |
| 28 | +I started the [2024 Advent of Code][aoc2024] in JS, but switched to Rust after a few days. Some of the native features of Rust like [enumerations][rust-enum] and [match expressions][rust-match], hardly the most unique or groundbreaking, made some of the problems easier to reason about for me. |
| 29 | + |
| 30 | +Also, my Advent of Code solutions tend not to be most efficient as my maths background is a bit weak, so using a performant language like Rust serves to compensate for some of that. |
| 31 | + |
| 32 | +You can [check out my solutions here][my-aoc2024] if you're interested. |
| 33 | + |
| 34 | +## WASM Game of Life 🧬 |
| 35 | + |
| 36 | +There's a fantastic [book on the Rust website][rust-wasm-book] that covers getting started with compiling Rust to WebAssembly. The book's tutorial covers building [Conway's Game of Life][game-of-life], and you can find [my implementation of it here][my-gol]. |
| 37 | + |
| 38 | +[rust-lang]: https://www.rust-lang.org/ |
| 39 | +[wasm]: https://developer.mozilla.org/en-US/docs/WebAssembly |
| 40 | +[aoc2024]: https://adventofcode.com/2024 |
| 41 | +[rust-enum]: https://doc.rust-lang.org/book/ch06-01-defining-an-enum.html |
| 42 | +[rust-match]: https://doc.rust-lang.org/book/ch06-02-match.html |
| 43 | +[my-aoc2024]: https://github.com/chrisnewtn/adventofcode2024 |
| 44 | +[rust-wasm-book]: https://rustwasm.github.io/docs/book/ |
| 45 | +[game-of-life]: https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life |
| 46 | +[my-gol]: https://game-of-life.chrisnewtn.com/ |
0 commit comments