This repository contains a starter Rust project to use with Advent of Code. This has none of the solutions to the puzzles, but includes some basic bootstrapping (i.e. reading the input file) and sets up a way to select the puzzle to execute.
There is also a basic shell for Day 1 to show how the interface works.
- Make sure you have Rust installed and set up with your IDE. I'm a big fan of Visual Studio Code for Rust, and use the Rust extension, but you can check out other tools for your favourite IDE.
- If you're just starting out with Rust, I recommend checking out the Rust book, but there are other Rust-based resources out there that might be more your style! Another popular place to get support is r/LearnRust, and there are books from big publishers like O'Reilly, and videos from platforms like PluralSight that can help
- If you would like to use external packages (which Rust calls 'crates'), you can check out crates.io to search, and docs.rs for documentation. For most of the 'standard' things, there is also a community-maintained list of recommended packages available at blessed.rs
- Check out the Advent of Code day 1 problem, and start writing your solution in the day one source file
- Update the LICENSE file with your name
- Add a call to your solution in
src/main.rs
- Run
cargo run -- <day>
for part 1,cargo run -- <day> -p 2
for part 2. If you'd like to select your input file, you can also do so with-f <file>
- Your output should be shown as the last line of text!
Run cargo run -- --help
from the command line to see the documentation for the CLI.
- A
main.rs
binary including: - A
lib.rs
that references theday_one
module. - A bare-bones
day_one.rs
. - A basic Github Actions workflow file for running automated tests
If you do not want to use the included logging setup or the solution metrics, you can disable these by disabling the relevant feature flags in Cargo.toml
. To do so, remove the feature flags you do not want to use from the defaults
line, under features
, like so:
[features]
default = []
logging = ["tracing", "tracing-subscriber"]
metrics = []
This will prevent the optional dependencies from being compiled, and will not enable the additional functionality associated with these features.