Skip to content

cannibalcow/rust_aoc2022

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advent of code 2022 in Rust

Result

result1-8 result9

Input files

Input files should be placed in root of the project with the format:

  • day_#_example1
  • day_#_example2
  • day_#_part1
  • day_#_part2

Utils

All utils functions is located in the aoc.rs

Benchmark

Run benchmark by cargo bench. Benchmark report is located in target/criterion

Template for day

Put days in ./days/ folder. Use this template:

    use crate::days::aoc::Solution;

    use super::aoc::Answer;

    pub struct <ReplaceMe> {}

    impl <ReplaceMe> {
        pub fn new() -> Self {
            Self {}
        }
    }

    impl Solution for <ReplaceMe> {
        fn solve_example1(&self) -> Answer {
            let instant = self.timer_start();
            return Answer::new("answer example1", instant.elapsed());
        }

        fn solve_part1(&self) -> Answer {
            let instant = self.timer_start();
            return Answer::new("answer part1", instant.elapsed());
        }

        fn solve_example2(&self) -> Answer {
            let instant = self.timer_start();
            return Answer::new("answer example2", instant.elapsed());
        }

        fn solve_part2(&self) -> Answer {
            let instant = self.timer_start();
            return Answer::new("answer part2", instant.elapsed());
        }

        fn get_day(&self) -> i32 {
            return <DAY_NUMBER>
        }
    }

    #[cfg(test)]
    mod tests {
        use super::*;
    }

About

Advent of code 2022 in Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages