advent-of-code/2022/rust
2023-12-01 02:47:18 -06:00
..
src Day 16 parsh 2022-12-19 22:29:55 -06:00
.envrc Part 1 2023-12-01 02:47:18 -06:00
.gitignore Part 1 2023-12-01 02:47:18 -06:00
Cargo.lock Add rust solution 2022-12-01 16:14:26 -06:00
Cargo.toml Day 11 part 1 done 2022-12-15 01:33:28 -06:00
fetch_input.sh Part 1 2023-12-01 02:47:18 -06:00
flake.lock Part 1 2023-12-01 02:47:18 -06:00
flake.nix Part 1 2023-12-01 02:47:18 -06:00
readme.md Cleanup 2022-12-04 01:25:36 -06:00

Rust Advent of Code 2022 Solutions

I've been writing more Rust this year for an internal tool at work and have really enjoyed the tooling. I intent to do more with Rust this year than last and aim for good performance (without bending over too far backwards, anyways...)

Competing

I compete very lightly. I use my at script like at 2022-12-02 && ./ fetch_input.sh 2 to fetch input as soon as it's available and I use watchexec -e rs 'C; clear; cargo test --bin day2 && cargo run --bin day2' to run my file(s) as I edit them.

Running

First, you will want to fetch your input for the day you want to run. You will need curl and your Advent of Code cookie in ~/.advent-of-code-session-cookie to run the following script:

./fetch_input.sh 1

Where 1 is the day's input you want to fetch.

Debug

cargo run --bin day1

Tests

cargo test --bin day1

Release Mode

For speeeeeed!

cargo build --release --bin day1
time ./target/release/day1

Everything

You can use this fish script to build all binaries in release mode and run/ time them all:

cargo build --release --bins
time for f in (fd 'day.' target/release/ --type executable --max-depth 1); echo $f; time $f; end