summaryrefslogtreecommitdiff
path: root/2020/rust
diff options
context:
space:
mode:
authorcos <cos>2020-12-01 22:43:27 +0100
committercos <cos>2020-12-01 22:43:27 +0100
commit7f574fb4dd72a59961eda90c491e33d438030317 (patch)
tree906097f4f37ef069242e53b5fa068f4b1728b9f0 /2020/rust
parentb2087ba800937e357a94ff7491cefae15e5198ef (diff)
downloadadventofcode-7f574fb4dd72a59961eda90c491e33d438030317.zip
Add initial aoc common code
Diffstat (limited to '2020/rust')
-rw-r--r--2020/rust/aoc/Cargo.toml5
-rw-r--r--2020/rust/aoc/src/lib.rs13
2 files changed, 18 insertions, 0 deletions
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 <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)
+ }
+}