From 7f574fb4dd72a59961eda90c491e33d438030317 Mon Sep 17 00:00:00 2001 From: cos Date: Tue, 1 Dec 2020 22:43:27 +0100 Subject: Add initial aoc common code --- 2020/rust/aoc/Cargo.toml | 5 +++++ 2020/rust/aoc/src/lib.rs | 13 +++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 2020/rust/aoc/Cargo.toml create mode 100644 2020/rust/aoc/src/lib.rs (limited to '2020') diff --git a/2020/rust/aoc/Cargo.toml b/2020/rust/aoc/Cargo.toml new file mode 100644 index 0000000..63cc48e --- /dev/null +++ b/2020/rust/aoc/Cargo.toml @@ -0,0 +1,5 @@ +[package] +name = "aoc" +version = "0.1.0" +authors = ["cos "] +edition = "2018" diff --git a/2020/rust/aoc/src/lib.rs b/2020/rust/aoc/src/lib.rs new file mode 100644 index 0000000..bd0c31e --- /dev/null +++ b/2020/rust/aoc/src/lib.rs @@ -0,0 +1,13 @@ +use std::env; + +pub fn do_parts() -> (bool, bool) { + match env::var("AOC_PARTS") { + Ok(parts) => { + let do_part_1 = parts.contains('1'); + let do_part_2 = parts.contains('2'); + + (do_part_1, do_part_2) + }, + Err(_) => (true, true) + } +} -- cgit v1.2.3