Articles tagged #rust

Day 4 (Advent of Code 2020)

It’s time for Day 4 of the Advent of Code 2020!

Now, I’ve already had a look at the problem statement, at least for part 1, and I’m not particularly excited.

But it will allow me to underline some of the points I’ve recently been *trying to make about types and correctness.

Cool bear

Ah, yes, the novel.

The problem is to parse passports, with fields like these:

Day 3 (Advent of Code 2020)

Hello all, and welcome back to Advent of Code 2020, featuring Cool Bear.

Cool bear

Hey y’all!

Let’s get right to it.

The problem statement for Day 3 is as follows: we’re given a map, that looks like this:

..##....... #...#...#.. .#....#..#. ..#.#...#.# .#...##..#. ..#.##..... .#.#.#....# .#........# #.##...#... #...##....# .#..#...#.#

And we imagine that it repeats infinitely to the right, like so:

Day 2 (Advent of Code 2020)

Cool bear

Day 2, Day 2! Woo!

The Advent of Code 2020, Day 2 problem talks about passwords. Sounds familiar.

Basically, our input looks like this:

1-3 a: abcde 1-3 b: cdefg 2-9 c: ccccccccc

Each line contains a “password policy” and a “password”. For the first line, the policy is that the password must contain between 1 and 3 (inclusive) times the letter “a”.

Advent of Code 2020

Let’s use the Advent of Code 2020, a series of programming challenges of increasing difficulty, to learn more about the Rust programming language.

Day 1 (Advent of Code 2020)

I was not planning on doing anything specific this December, but a lot of folks around me (on Twitter, at work) have chosen this Advent of Code to pick up Rust, and I’ve got big FOMO energy, so, let’s see where this goes.

I’ll be doing all of these on Linux, so there may be some command-line tools involved, but don’t worry about them - the code itself should run on all platforms no problem.

Aiming for correctness with types

The Nature weekly journal of science was first published in 1869. And after one and a half century, it has finally completed one cycle of carcinization, by publishing an article about the Rust programming language.

It’s a really good article.

What I liked about this article is that it didn’t just talk about performance, or even just memory safety - it also talked about correctness.

So you want to live-reload Rust

Good morning! It is still 2020, and the world is literally on fire, so I guess we could all use a distraction.

This article continues the tradition of me getting shamelessly nerd-sniped - once by Pascal about small strings, then again by a twitch viewer about Rust enum sizes.

This time, Ana was handing out free nerdsnipes, so I got in line, and mine was:

Peeking inside a Rust enum

During a recent Rust Q&A Session on my twitch channel, someone asked a question that seemed simple: why are small string types, like SmartString or SmolStr, the same size as String, but small vec types, like SmallVec, are larger than Vec?

Now I know I just used the adjective simple, but the truth of the matter is: to understand the question, we’re going to need a little bit of background.

Go back to the homepage.