feat: download_all and async downloading with tokio

This commit is contained in:
2022-12-31 19:29:50 +01:00
parent 0000023023
commit 00000240a0
5 changed files with 142 additions and 20 deletions

View File

@@ -1,9 +1,9 @@
use dotenv::dotenv;
use reqwest::blocking::Client;
use reqwest::header;
use reqwest::{header, Client};
use std::{env, fs::OpenOptions, io::Write, process};
fn main() {
#[tokio::main]
async fn main() {
let day: u8 = match aoc::parse_args() {
Ok(day) => day,
Err(_) => {
@@ -30,8 +30,10 @@ fn main() {
let res = client
.get(format!("https://adventofcode.com/{year}/day/{day}/input"))
.send()
.await
.unwrap()
.text()
.await
.unwrap();
let input_path = format!("src/inputs/{day_padded}.txt");