Crate aoc_driver

Source
Expand description

§Aoc Helpers

All functionality requires AoC session cookie, which you can get from you browser after logging in

(look in developer tools)

The most obvious way to use this library is with the calculate_and_post function

use aoc_driver::*;

fn solution(i: &str) -> String { unimplemented!() }

let session = std::fs::read_to_string(".session.txt").unwrap();
calculate_and_post(
    session,
    2020,
    1,
    Part1,
    Some("inputs/2020/1.txt"),
    Some("cache/2022/1.json"),
    solution
).unwrap();

There is an even faster way though using the aoc_magic macro

use aoc_driver::*;

fn solution(i: &str) -> String { unimplemented!() }

let session = std::fs::read_to_string(".session.txt").unwrap();
aoc_magic!(session, 2020:1:1, solution).unwrap()

This macro does the same as the above function call (including creating an inputs and cache directory), but more concisely

Re-exports§

pub use Part::*;

Modules§

error

Macros§

aoc_magic
Magic macro to make AoC even easier

Enums§

Part
Simple way to represent the challenge part

Functions§

calculate_and_post
Fetches the challenge input, calculate the answer, and post it to the AoC website
get_input
Get some input from the AoC website
get_input_or_file
Gets challenge input - caching at path if required
post_answer
Post an answer to the AoC website.