switched to workspaces.

This should let me make a cross-day library.
This commit is contained in:
Gabe Venberg 2023-11-19 20:32:41 -06:00
parent 1469c3a32b
commit 242989bb95
57 changed files with 156 additions and 89 deletions

105
Cargo.lock generated
View file

@ -3,51 +3,70 @@
version = 3
[[package]]
name = "advent_of_code_2022"
name = "aho-corasick"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
dependencies = [
"memchr",
]
[[package]]
name = "day01"
version = "0.1.0"
[[package]]
name = "day02"
version = "0.1.0"
[[package]]
name = "day03"
version = "0.1.0"
[[package]]
name = "day04"
version = "0.1.0"
dependencies = [
"once_cell",
"regex",
]
[[package]]
name = "day05"
version = "0.1.0"
dependencies = [
"once_cell",
"regex",
]
[[package]]
name = "day06"
version = "0.1.0"
[[package]]
name = "day07"
version = "0.1.0"
dependencies = [
"nom",
"once_cell",
"regex",
"thiserror",
]
[[package]]
name = "aho-corasick"
version = "0.7.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
dependencies = [
"memchr",
]
name = "day08"
version = "0.1.0"
[[package]]
name = "memchr"
version = "2.5.0"
version = "2.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "minimal-lexical"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "nom"
version = "7.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
dependencies = [
"memchr",
"minimal-lexical",
]
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
[[package]]
name = "once_cell"
version = "1.16.0"
version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
[[package]]
name = "proc-macro2"
@ -69,9 +88,21 @@ dependencies = [
[[package]]
name = "regex"
version = "1.7.0"
version = "1.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a"
checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
dependencies = [
"aho-corasick",
"memchr",
@ -80,21 +111,25 @@ dependencies = [
[[package]]
name = "regex-syntax"
version = "0.6.28"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]]
name = "syn"
version = "2.0.38"
version = "2.0.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b"
checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "template"
version = "0.1.0"
[[package]]
name = "thiserror"
version = "1.0.50"

View file

@ -1,49 +1,19 @@
[package]
name = "advent_of_code_2022"
[workspace]
members = [
"template",
"days/*",
]
default-members = [ "days/*" ]
resolver = "2"
[workspace.package]
version = "0.1.0"
authors=["Gabriel Venberg"]
authors = ["Gabriel Venberg"]
edition = "2021"
description = "advent of code 2022 in rust"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[[bin]]
name="template"
path="src/template/solve.rs"
[[bin]]
name="day01"
path="src/day01/solve.rs"
[[bin]]
name="day02"
path="src/day02/solve.rs"
[[bin]]
name="day03"
path="src/day03/solve.rs"
[[bin]]
name="day04"
path="src/day04/solve.rs"
[[bin]]
name="day05"
path="src/day05/solve.rs"
[[bin]]
name="day06"
path="src/day06/solve.rs"
[[bin]]
name="day07"
path="src/day07/solve.rs"
[[bin]]
name="day08"
path="src/day08/solve.rs"
[dependencies]
regex="1"
[workspace.dependencies]
regex = "1"
once_cell = "1.16"
nom = "7.1"
thiserror = "1.0"
nom = "7.1"

6
days/day01/Cargo.toml Normal file
View file

@ -0,0 +1,6 @@
[package]
name = "day01"
authors.workspace = true
description.workspace = true
version.workspace = true
edition.workspace = true

6
days/day02/Cargo.toml Normal file
View file

@ -0,0 +1,6 @@
[package]
name = "day02"
authors.workspace = true
description.workspace = true
version.workspace = true
edition.workspace = true

6
days/day03/Cargo.toml Normal file
View file

@ -0,0 +1,6 @@
[package]
name = "day03"
authors.workspace = true
description.workspace = true
version.workspace = true
edition.workspace = true

10
days/day04/Cargo.toml Normal file
View file

@ -0,0 +1,10 @@
[package]
name = "day04"
authors.workspace = true
description.workspace = true
version.workspace = true
edition.workspace = true
[dependencies]
once_cell.workspace = true
regex.workspace = true

10
days/day05/Cargo.toml Normal file
View file

@ -0,0 +1,10 @@
[package]
name = "day05"
authors.workspace = true
description.workspace = true
version.workspace = true
edition.workspace = true
[dependencies]
once_cell.workspace = true
regex.workspace = true

6
days/day06/Cargo.toml Normal file
View file

@ -0,0 +1,6 @@
[package]
name = "day06"
authors.workspace = true
description.workspace = true
version.workspace = true
edition.workspace = true

View file

@ -1,7 +1,3 @@
/* pub fn parse(input: &str) -> usize {
unimplemented!()
} */
pub fn find_dupes_stupid<T: PartialEq>(slice: &[T]) -> bool {
for i in 1..slice.len() {
if slice[i..].contains(&slice[i - 1]) {

11
days/day07/Cargo.toml Normal file
View file

@ -0,0 +1,11 @@
[package]
name = "day07"
authors.workspace = true
description.workspace = true
version.workspace = true
edition.workspace = true
[dependencies]
once_cell.workspace = true
regex.workspace = true
thiserror.workspace = true

6
days/day08/Cargo.toml Normal file
View file

@ -0,0 +1,6 @@
[package]
name = "day08"
authors.workspace = true
description.workspace = true
version.workspace = true
edition.workspace = true

View file

@ -1,4 +1,3 @@
#![allow(dead_code)]
mod part1;
mod part2;
mod utilities;

View file

@ -1,5 +1,4 @@
#![allow(unused)]
use crate::{utilities::*, StructuredInput};
use crate::StructuredInput;
pub fn part1(input: &StructuredInput) -> usize {
let mut acc: usize = 0;

View file

@ -1,5 +1,4 @@
#![allow(unused)]
use crate::{utilities::*, StructuredInput};
use crate::StructuredInput;
pub fn part2(input: &StructuredInput) -> usize {
let mut max: usize = 0;

View file

@ -1,4 +1,3 @@
#![allow(unused)]
pub fn parse(input: &str) -> Vec<Vec<u8>> {
input
.lines()

5
template/Cargo.toml Normal file
View file

@ -0,0 +1,5 @@
[package]
name = "template"
authors.workspace = true
description.workspace = true
version.workspace = true

View file

@ -1,3 +1,4 @@
//TODO:
#![allow(dead_code)]
mod part1;
mod part2;

View file

@ -1,3 +1,4 @@
//TODO:
#![allow(unused)]
use crate::utilities::*;

View file

@ -1,3 +1,4 @@
//TODO:
#![allow(unused)]
use crate::utilities::*;

View file

@ -1,3 +1,4 @@
//TODO:
#![allow(unused)]
pub fn parse(input: &str) -> usize {
unimplemented!()