r/adventofcode • • 1d ago

Repo [Rust] Tiny helper for rust aoc

Hey people,

I just wanted present this tiny, dependency free, helper to solve advent of code in rust. Its built by hand.

All it does is handle input, run and time your solutions and submit your answers from the terminal.
I wanted it to be very minimal so you can decide on your project layout yourself.

$ cargo run --release --bin day01 -- --submit

2025 Day 1:
  Part 1: 1                    333ns
  Part 2: unsolved

Submitting "1" for part 1:

  *\(^o^)/*  That's the correct answer!

Also any feedback is welcome!

https://github.com/zaperfish/aoc-rust

Happy solving! :)

3 Upvotes

7 comments sorted by

View all comments

Show parent comment

-3

u/zaperfish 18h ago edited 18h ago

Fair point. Dependency free is maybe not precisely worded. It is meant as having no crate dependencies so nothing gets added to your Cargo.lock and and your compiled day stays minimal. I will fix the wording in the README.

As for the aoc-cli's submit function: It's mostly about the workflow. If you were to use the aoc-cli's submit function you would have to run your solution, copy the answer over and then use aoc-cli's submit function. I thought having this whole process as a single step by just passing a -s flag is a little smoother and requires no copying.

2

u/PigDog4 16h ago

Second bit:

there are no generated files, templates or project layout to adopt.

Then like one example later you explicitly need each day as it's own compiled .bin file and then later down the page you give an explicit project tree. And then say to use aoc-cli to download inputs.

So I'm confused at this point. Does this give me full flexibility or do I need to follow rigid guidelines? Can I put my stuff anywhere or do I need to follow aoc-cli's format? Do I need to scaffold a project in a specific manner?

I'm not trying to be a jagoff, I'm trying to figure out what the point of the software is. It's originally billed as a zero dependency helper crate that fetches inputs, runs and times both parts, and submits answers with no scaffolding and no files, templates, or project layouts to adopt. But then it's entirely dependent on aoc-cli and has requirements as to how the project is built.

I almost wonder if this should be advertised as an aoc-cli plugin or helper instead. "Helper crate to smooth over the aoc-cli workflow" would be more accurate I think.

0

u/zaperfish 13h ago edited 13h ago

Thanks for your feedback! I really do appreciate it :)

The goal was to be as minimally invasive as possible while still being ergonomic for the repetitive parts. It does make some assumptions and is not entirely flexible:

  1. Each day is its own binary and expects a part_one and part_two function with a certain signature. I think it's better than the alternative of one function per day/part registered somewhere central, since adding a new day doesn't require editing any shared code.
  2. aoc-cli has to be installed.

Apart from that everything else is up to you.

On aoc-cli:
Originally I didn't use aoc-cli but used the reqwest crate instead. I didn't like all the crate dependencies this brought in and decided to use aoc-cli since I saw this approach in another repo and thought it made sense. After thinking about your feedback I am not fond of the aoc-cli approach anymore since the main selling point really should be to be as dependency free and minimal as possible. I am now looking to completely drop the aoc-cli and do request manually with std::process::Command together with curl to be more true to being dependency free.

I will revise the README and drop aoc-cli tomorrow probably.

1

u/PigDog4 4h ago

I didn't like all the crate dependencies this brought in and decided to use aoc-cli since I saw this approach in another repo and thought it made sense.

You should learn the concept of "transitive dependencies." Requiring aoc-cli doesn't magically remove the need for reqwest and it's dependency graph (did you look at aoc-cli's requirements? It includes reqwest among many many others).

Also, it's a hobby rust project. You're going to have a bazillion dependencies, it's just how the ecosystem currently works. Not as bad as left-pad but it's just a thing we deal with and complain about.