diff options
-rw-r--r-- | Cargo.lock | 19 | ||||
-rw-r--r-- | Cargo.toml | 14 | ||||
-rw-r--r-- | aoc_2022/Cargo.lock | 23 | ||||
-rw-r--r-- | aoc_2022/Cargo.toml | 11 | ||||
-rw-r--r-- | aoc_2022/input/day_1.txt (renamed from input/day_1.txt) | 0 | ||||
-rw-r--r-- | aoc_2022/input/day_2.txt (renamed from input/day_2.txt) | 0 | ||||
-rw-r--r-- | aoc_2022/input/day_3.txt (renamed from input/day_3.txt) | 0 | ||||
-rw-r--r-- | aoc_2022/input/day_4.txt (renamed from input/day_4.txt) | 0 | ||||
-rw-r--r-- | aoc_2022/input/day_5.txt (renamed from input/day_5.txt) | 0 | ||||
-rw-r--r-- | aoc_2022/input/day_6.txt (renamed from input/day_6.txt) | 0 | ||||
-rw-r--r-- | aoc_2022/input/day_7.txt (renamed from input/day_7.txt) | 0 | ||||
-rw-r--r-- | aoc_2022/input/day_8.txt (renamed from input/day_8.txt) | 0 | ||||
-rw-r--r-- | aoc_2022/src/day_1.rs (renamed from src/day_1.rs) | 2 | ||||
-rw-r--r-- | aoc_2022/src/day_2.rs (renamed from src/day_2.rs) | 2 | ||||
-rw-r--r-- | aoc_2022/src/day_3.rs (renamed from src/day_3.rs) | 2 | ||||
-rw-r--r-- | aoc_2022/src/day_4.rs (renamed from src/day_4.rs) | 2 | ||||
-rw-r--r-- | aoc_2022/src/day_5.rs (renamed from src/day_5.rs) | 2 | ||||
-rw-r--r-- | aoc_2022/src/day_6.rs (renamed from src/day_6.rs) | 2 | ||||
-rw-r--r-- | aoc_2022/src/day_7.rs (renamed from src/day_7.rs) | 2 | ||||
-rw-r--r-- | aoc_2022/src/day_8.rs (renamed from src/day_8.rs) | 2 | ||||
-rw-r--r-- | aoc_2022/src/lib.rs | 11 | ||||
-rw-r--r-- | aoc_2022/src/main.rs (renamed from src/main.rs) | 7 | ||||
-rw-r--r-- | input/day_1.txt:Zone.Identifier | 4 | ||||
-rw-r--r-- | src/lib.rs | 11 |
24 files changed, 82 insertions, 34 deletions
@@ -3,7 +3,13 @@ version = 3 [[package]] -name = "advent_of_code_2022" +name = "anyhow" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" + +[[package]] +name = "aoc" version = "0.1.0" dependencies = [ "anyhow", @@ -11,10 +17,13 @@ dependencies = [ ] [[package]] -name = "anyhow" -version = "1.0.66" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" +name = "aoc_2022" +version = "0.1.0" +dependencies = [ + "anyhow", + "aoc", + "indoc", +] [[package]] name = "indoc" @@ -1,10 +1,18 @@ [package] -name = "advent_of_code_2022" +name = "aoc" version = "0.1.0" edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +description = "Library used for Advent of Code solution crates" [dependencies] +anyhow = { workspace = true } +indoc = { workspace = true } + +[workspace] +members = ["aoc_2022"] +default-members = ["aoc_2022"] + +[workspace.dependencies] +aoc = { path = "." } anyhow = "1.0.66" indoc = "1.0.7" diff --git a/aoc_2022/Cargo.lock b/aoc_2022/Cargo.lock new file mode 100644 index 0000000..2823f71 --- /dev/null +++ b/aoc_2022/Cargo.lock @@ -0,0 +1,23 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "advent_of_code_2022" +version = "0.1.0" +dependencies = [ + "anyhow", + "indoc", +] + +[[package]] +name = "anyhow" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" + +[[package]] +name = "indoc" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adab1eaa3408fb7f0c777a73e7465fd5656136fc93b670eb6df3c88c2c1344e3" diff --git a/aoc_2022/Cargo.toml b/aoc_2022/Cargo.toml new file mode 100644 index 0000000..4bc060e --- /dev/null +++ b/aoc_2022/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "aoc_2022" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +aoc = { workspace = true } +anyhow = { workspace = true } +indoc = { workspace = true } diff --git a/input/day_1.txt b/aoc_2022/input/day_1.txt index e329ff7..e329ff7 100644 --- a/input/day_1.txt +++ b/aoc_2022/input/day_1.txt diff --git a/input/day_2.txt b/aoc_2022/input/day_2.txt index 787ae71..787ae71 100644 --- a/input/day_2.txt +++ b/aoc_2022/input/day_2.txt diff --git a/input/day_3.txt b/aoc_2022/input/day_3.txt index 5533a94..5533a94 100644 --- a/input/day_3.txt +++ b/aoc_2022/input/day_3.txt diff --git a/input/day_4.txt b/aoc_2022/input/day_4.txt index c2c3af1..c2c3af1 100644 --- a/input/day_4.txt +++ b/aoc_2022/input/day_4.txt diff --git a/input/day_5.txt b/aoc_2022/input/day_5.txt index 922b345..922b345 100644 --- a/input/day_5.txt +++ b/aoc_2022/input/day_5.txt diff --git a/input/day_6.txt b/aoc_2022/input/day_6.txt index 5f190e2..5f190e2 100644 --- a/input/day_6.txt +++ b/aoc_2022/input/day_6.txt diff --git a/input/day_7.txt b/aoc_2022/input/day_7.txt index ca23499..ca23499 100644 --- a/input/day_7.txt +++ b/aoc_2022/input/day_7.txt diff --git a/input/day_8.txt b/aoc_2022/input/day_8.txt index 8f78128..8f78128 100644 --- a/input/day_8.txt +++ b/aoc_2022/input/day_8.txt diff --git a/src/day_1.rs b/aoc_2022/src/day_1.rs index 8fcc6ce..c8a7672 100644 --- a/src/day_1.rs +++ b/aoc_2022/src/day_1.rs @@ -1,6 +1,6 @@ use anyhow::{Context, Result}; -use crate::{Problem, Solution}; +use aoc::{Problem, Solution}; pub struct Day1; diff --git a/src/day_2.rs b/aoc_2022/src/day_2.rs index f9e207b..d14b97d 100644 --- a/src/day_2.rs +++ b/aoc_2022/src/day_2.rs @@ -2,7 +2,7 @@ use std::str::FromStr; use anyhow::{anyhow, Result}; -use crate::{Problem, Solution}; +use aoc::{Problem, Solution}; #[derive(Debug, Clone, Copy, PartialEq, Eq)] struct Game { diff --git a/src/day_3.rs b/aoc_2022/src/day_3.rs index a549e52..0595f14 100644 --- a/src/day_3.rs +++ b/aoc_2022/src/day_3.rs @@ -2,7 +2,7 @@ use std::{ops::Deref, str::FromStr}; use anyhow::{anyhow, Context, Result}; -use crate::{Problem, Solution}; +use aoc::{Problem, Solution}; trait Priority { fn priority(self) -> Result<u8>; diff --git a/src/day_4.rs b/aoc_2022/src/day_4.rs index 690ccd1..659f76d 100644 --- a/src/day_4.rs +++ b/aoc_2022/src/day_4.rs @@ -2,7 +2,7 @@ use std::ops::Range; use anyhow::Result; -use crate::{Problem, Solution}; +use aoc::{Problem, Solution}; pub fn parse_range(section: &str) -> Result<Range<usize>> { let (start, end) = section.split_once('-').unwrap(); diff --git a/src/day_5.rs b/aoc_2022/src/day_5.rs index 006a59a..11347ce 100644 --- a/src/day_5.rs +++ b/aoc_2022/src/day_5.rs @@ -6,7 +6,7 @@ use std::{ use anyhow::{Context, Result}; -use crate::{Problem, Solution}; +use aoc::{Problem, Solution}; #[derive(Debug)] struct Procedure(Vec<Step>); diff --git a/src/day_6.rs b/aoc_2022/src/day_6.rs index 5983400..5abef0a 100644 --- a/src/day_6.rs +++ b/aoc_2022/src/day_6.rs @@ -2,7 +2,7 @@ use std::collections::HashSet; use anyhow::Result; -use crate::{Problem, Solution}; +use aoc::{Problem, Solution}; fn get_window_pos(input: &str, win_size: usize) -> Option<usize> { input diff --git a/src/day_7.rs b/aoc_2022/src/day_7.rs index 70e5448..09eb1ef 100644 --- a/src/day_7.rs +++ b/aoc_2022/src/day_7.rs @@ -2,7 +2,7 @@ use std::{collections::HashMap, fmt::Display, ops::Deref, str::FromStr}; use anyhow::{anyhow, Context, Result}; -use crate::{Problem, Solution}; +use aoc::{Problem, Solution}; enum Cmd { Root, diff --git a/src/day_8.rs b/aoc_2022/src/day_8.rs index 145bc22..6c44462 100644 --- a/src/day_8.rs +++ b/aoc_2022/src/day_8.rs @@ -2,7 +2,7 @@ use std::{collections::HashSet, fmt::Display}; use anyhow::Result; -use crate::{Problem, Solution}; +use aoc::{Problem, Solution}; type TreeHeight = i8; diff --git a/aoc_2022/src/lib.rs b/aoc_2022/src/lib.rs new file mode 100644 index 0000000..d3d4aea --- /dev/null +++ b/aoc_2022/src/lib.rs @@ -0,0 +1,11 @@ +#![feature(iterator_try_collect)] +#![feature(iter_next_chunk)] + +pub mod day_1; +pub mod day_2; +pub mod day_3; +pub mod day_4; +pub mod day_5; +pub mod day_6; +pub mod day_7; +pub mod day_8; diff --git a/src/main.rs b/aoc_2022/src/main.rs index 352aca6..3c26a16 100644 --- a/src/main.rs +++ b/aoc_2022/src/main.rs @@ -1,8 +1,9 @@ -use advent_of_code_2022::{ +use anyhow::Result; +use aoc::Solution; +use aoc_2022::{ day_1::Day1, day_2::Day2, day_3::Day3, day_4::Day4, day_5::Day5, day_6::Day6, day_7::Day7, - day_8::Day8, Solution, + day_8::Day8, }; -use anyhow::Result; fn main() -> Result<()> { Day1::solve()?; diff --git a/input/day_1.txt:Zone.Identifier b/input/day_1.txt:Zone.Identifier deleted file mode 100644 index 976d49d..0000000 --- a/input/day_1.txt:Zone.Identifier +++ /dev/null @@ -1,4 +0,0 @@ -[ZoneTransfer]
-ZoneId=3
-ReferrerUrl=https://adventofcode.com/2022/day/1
-HostUrl=https://adventofcode.com/2022/day/1/input
@@ -1,5 +1,3 @@ -#![feature(iterator_try_collect)] -#![feature(iter_next_chunk)] #![feature(associated_type_defaults)] pub trait Solution: Problem { @@ -25,12 +23,3 @@ pub trait Problem { const INPUT: &'static str; } - -pub mod day_1; -pub mod day_2; -pub mod day_3; -pub mod day_4; -pub mod day_5; -pub mod day_6; -pub mod day_7; -pub mod day_8; |