day 2 and revised day 1 with advantage of DoubleEndedIterator

This commit is contained in:
RingOfStorms (Joshua Bell) 2023-12-02 01:00:41 -06:00
parent b2f78d33e7
commit 69b53f37a6
11 changed files with 2392 additions and 28 deletions

View file

@ -1,7 +1,4 @@
use std::{
env::var,
sync::OnceLock,
};
use std::{env::var, sync::OnceLock};
static CONFIG: OnceLock<Config> = OnceLock::new();
@ -9,13 +6,15 @@ pub struct Config {
pub aoc_session: String,
}
impl Config { }
impl Config {}
fn get_var(var_name: &str) -> String {
var(var_name).unwrap_or("".to_owned())
}
pub fn get_config() -> &'static Config {
let config = CONFIG.get_or_init(|| Config { aoc_session: get_var("AOC_SESSION") });
let config = CONFIG.get_or_init(|| Config {
aoc_session: get_var("AOC_SESSION"),
});
config
}

View file

@ -1,3 +1,3 @@
pub mod aoc;
pub mod common;
pub mod config;
pub mod aoc;