This commit is contained in:
Spectre 2024-12-02 23:24:40 +01:00
parent e1ca0d5f61
commit 73e90776ed
9 changed files with 455 additions and 241 deletions

View file

@ -12,6 +12,8 @@ use std::{time::Instant, env};
fn main() {
let year = 2024;
let day = 2;
fetch_data(year, day).unwrap();
let Ok(data) = load_actual(year, day)
else { panic!("No Input Data"); };
@ -33,7 +35,7 @@ fn main() {
}
fn fetch_data(year, day) -> Result<(), Box<dyn std::error::Error>> {
fn fetch_data(year: usize, day: usize) -> Result<(), Box<dyn std::error::Error>> {
let url = format!("https://adventofcode.com/{year}/day/{day}/input");
let session_cookie = env::var("ADVENT_TOKEN")?;
@ -43,8 +45,8 @@ fn fetch_data(year, day) -> Result<(), Box<dyn std::error::Error>> {
.header(COOKIE, session_cookie)
.send()?;
let body = response.text()?;
println!("Response: {}", body);
let body = response.text();
println!("Response: {:?}", body);
Ok(())
}