Crates.io | aoc_driver |
lib.rs | aoc_driver |
version | 0.3.6 |
source | src |
created_at | 2021-11-29 10:52:57.648564 |
updated_at | 2023-12-01 20:22:59.989882 |
description | helper macros and functions for AoC |
homepage | |
repository | https://github.com/Ben-Lichtman/aoc_driver |
max_upload_size | |
id | 489210 |
size | 14,636 |
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