Crate aoc_cache

source ·
Expand description

A way of caching your input from the great and popular Advent of Code.

This is an attempt to reduce server load for the creator.

Downloads using ureq, stores cache in temporary files using scratch.

Example

use aoc_cache::get;
// my.cookie is a file containing the cookie string.
const MY_COOKIE: &str = include_str!("my.cookie");
let input: Result<String, aoc_cache::Error> = // Grabs from web if it's the first run
    get("https://adventofcode.com/2022/day/1/input", MY_COOKIE);
let input: Result<String, aoc_cache::Error> = // Grabs from cache
    get("https://adventofcode.com/2022/day/1/input", MY_COOKIE);

Enums

Functions

Gets input from the url or from cache if it has been retrieved before.
Dispatches to the get-function, see its documentation.