Skip to main content

submit

Function submit 

Source
pub fn submit(
    day: usize,
    year: usize,
    answer: &str,
    riddle_part: u8,
    token: Option<&str>,
) -> Result<()>
Expand description

Submits an answer to Advent of Code servers

§Arguments

  • day - the day of the challenge. [1 - 25]
  • year - the year of the challenge. E.g. 2023
  • answer - the submitted answer
  • riddle_part - either 1 or 2 indicating, respectively, part one and two of the riddle
  • token - optionally, the token used to authenticate you against AOC servers

§Examples

use elv::submit;
fn submit_answer(answer: &str) {
    // Submits answer `12344` to the first part of thefirst day of the 2023 AOC.
    // This invocation will not work if you do not supply the token
    // some other way.
    submit(1, 2023, "12344", 1, None).unwrap();
    // Submits answer `something` to the second part of the 20th day of the 2019 challenge.
    // This invocation does not need the token set any other way.
    submit(20, 2019, "something", 2, Some("Mytoken")).unwrap();
}