refactor folder structure

This commit is contained in:
JonOfUs 2022-12-06 16:04:04 +01:00
parent 3bdf2b156e
commit f5a7defd00
10 changed files with 59 additions and 8 deletions

49
Cargo.lock generated
View file

@ -5,3 +5,52 @@ version = 3
[[package]] [[package]]
name = "advent-of-code-2022" name = "advent-of-code-2022"
version = "0.1.0" version = "0.1.0"
dependencies = [
"automod",
]
[[package]]
name = "automod"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7feac164c18ee671e3e01be1ab9c0a362f5ef3eda26d44b06f1df897cd43c4e"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "proc-macro2"
version = "1.0.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
dependencies = [
"proc-macro2",
]
[[package]]
name = "syn"
version = "1.0.105"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "unicode-ident"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"

View file

@ -6,3 +6,4 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
automod = "1.0.4"

1
src/days.rs Normal file
View file

@ -0,0 +1 @@
automod::dir!(pub "src/days");

View file

@ -1,6 +1,6 @@
use std::fs; use std::fs;
pub fn d01() { pub fn solve() {
let path = "res/01/input.txt"; let path = "res/01/input.txt";
let contents = fs::read_to_string(path) let contents = fs::read_to_string(path)

View file

@ -1,6 +1,6 @@
use std::fs; use std::fs;
pub fn d02() { pub fn solve() {
let path = "res/02/input.txt"; let path = "res/02/input.txt";
let contents = fs::read_to_string(path).expect("Should have been able to read the file"); let contents = fs::read_to_string(path).expect("Should have been able to read the file");

View file

@ -2,7 +2,7 @@ use std::collections::HashMap;
use std::collections::HashSet; use std::collections::HashSet;
use std::fs; use std::fs;
pub fn d03() { pub fn solve() {
let path = "res/03/input.txt"; let path = "res/03/input.txt";
let contents = fs::read_to_string(path).expect("I/O error, wrong path?"); let contents = fs::read_to_string(path).expect("I/O error, wrong path?");

View file

@ -1,6 +1,6 @@
use std::fs; use std::fs;
pub fn d04() { pub fn solve() {
let path = "res/04/input.txt"; let path = "res/04/input.txt";
let contents = fs::read_to_string(path).expect("I/O error, wrong path?"); let contents = fs::read_to_string(path).expect("I/O error, wrong path?");

View file

@ -1,6 +1,6 @@
use std::fs; use std::fs;
pub fn d05() { pub fn solve() {
let path = "res/05/input.txt"; let path = "res/05/input.txt";
let contents = fs::read_to_string(path).expect("I/O error, wrong path?"); let contents = fs::read_to_string(path).expect("I/O error, wrong path?");

View file

@ -1,7 +1,7 @@
use std::collections::HashSet; use std::collections::HashSet;
use std::fs; use std::fs;
pub fn d06() { pub fn solve() {
let path = "res/06/input.txt"; let path = "res/06/input.txt";
let contents = fs::read_to_string(path).expect("I/O error, wrong path?"); let contents = fs::read_to_string(path).expect("I/O error, wrong path?");

View file

@ -1,5 +1,5 @@
mod d06; pub mod days;
fn main() { fn main() {
d06::d06(); days::d06::solve();
} }