diff --git a/rust/2021/.gitignore b/rust/2021/.gitignore new file mode 100644 index 0000000..28935af --- /dev/null +++ b/rust/2021/.gitignore @@ -0,0 +1,3 @@ +/.vscode +/target +/input \ No newline at end of file diff --git a/rust/2021/Cargo.lock b/rust/2021/Cargo.lock new file mode 100644 index 0000000..260f8dd --- /dev/null +++ b/rust/2021/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "advent-of-code-2021" +version = "0.1.0" diff --git a/rust/2021/src/day_01.rs b/rust/2021/src/day_01.rs new file mode 100644 index 0000000..d24ff15 --- /dev/null +++ b/rust/2021/src/day_01.rs @@ -0,0 +1,15 @@ +pub fn solve_part1(input: &str) -> &str { + input +} + +pub fn solve_part2(input: &str) -> &str { + input +} + +pub fn run(input: String) { + println!("--- Part 1 ---"); + println!("Answer: {}", solve_part1(&input)); + print!("\n"); + println!("--- Part 2 ---"); + println!("Answer: {}", solve_part1(&input)) +} diff --git a/rust/2021/src/lib.rs b/rust/2021/src/lib.rs new file mode 100644 index 0000000..61b873e --- /dev/null +++ b/rust/2021/src/lib.rs @@ -0,0 +1,5 @@ +mod day_01; + +pub fn run(input: String) { + day_01::run(input); +} diff --git a/rust/2021/src/main.rs b/rust/2021/src/main.rs index e7a11a9..7a36d05 100644 --- a/rust/2021/src/main.rs +++ b/rust/2021/src/main.rs @@ -1,3 +1,4 @@ fn main() { - println!("Hello, world!"); + let input = std::fs::read_to_string("./input/2020/day20.txt").expect("open input file"); + advent_of_code_2021::run(input); }