3 unstable releases

0.2.0 Jan 12, 2023
0.1.1 Jan 11, 2023
0.1.0 Jan 11, 2023

#27 in #year

Download history 21/week @ 2024-01-01 27/week @ 2024-01-08 20/week @ 2024-01-15 15/week @ 2024-01-22 9/week @ 2024-01-29 16/week @ 2024-02-05 27/week @ 2024-02-12 75/week @ 2024-02-19 43/week @ 2024-02-26 41/week @ 2024-03-04 43/week @ 2024-03-11 46/week @ 2024-03-18 44/week @ 2024-03-25 76/week @ 2024-04-01 34/week @ 2024-04-08 44/week @ 2024-04-15

204 downloads per month
Used in aoc-cli

MIT and GPL-3.0+

32KB
771 lines

aoc-client

Build and test Clippy and format crates.io

Advent of Code library 🎄

aoc-client is a Rust library for Advent of Code. It is used to build the aoc-cli command-line tool but can also be integrated into other projects.

Usage ⛄️

Add the following dependency to your Rust project (in Cargo.toml):

[dependencies]
aoc-client = "0.1"

Create a AocClient instance and call its methods:

use aoc_client::{AocClient, AocResult};

fn main() -> AocResult<()> {
    let client = AocClient::builder()
        .session_cookie_from_default_locations()?
        .year(2022)?
        .day(1)?
        .build()?;

    let _input: String = client.get_input()?;

    // Solve part 1 using your input and then submit your answer
    let answer_part1 = 1234;
    client.submit_answer(1, answer_part1)?;

    // Solve part 2 using your input and then submit your answer
    let answer_part2 = 5678;
    client.submit_answer(2, answer_part2)?;

    Ok(())
}

Contribute 🦌

Feedback and pull requests are welcome. Please see CONTRIBUTING for guidelines and ideas.

Support Advent of Code 🎁

Advent of Code is a free online Advent calendar of small programming puzzles created by Eric Wastl and maintained by volunteers. Please consider supporting their work.

Dependencies

~10–25MB
~390K SLoC