feat(template): update daily template

This commit is contained in:
2024-12-01 20:48:08 +02:00
parent 3c899e7782
commit 9020a27a4a
13 changed files with 923 additions and 42 deletions

View File

@@ -6,4 +6,18 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
color-eyre.workspace = true
itertools.workspace = true
nom.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true
miette.workspace = true
[dev-dependencies]
divan.workspace = true
rstest.workspace = true
test-log.workspace = true
[[bench]]
name = "{{project-name}}-bench"
path = "benches/benchmarks.rs"
harness = false

View File

@@ -0,0 +1,21 @@
use {{crate_name}}::*;
fn main() {
divan::main();
}
#[divan::bench]
fn part1() {
part1::process(divan::black_box(include_str!(
"../input1.txt",
)))
.unwrap();
}
#[divan::bench]
fn part2() {
part2::process(divan::black_box(include_str!(
"../input2.txt",
)))
.unwrap();
}

View File

@@ -1,9 +1,12 @@
use color_eyre::Result;
use {{crate_name}}::part1::process;
use miette::{Context, Result};
#[tracing::instrument]
fn main() -> Result<()> {
tracing_subscriber::fmt::init();
let file = include_str!("../../input1.txt");
let result = process(file)?;
let result = process(file).context("process part 1")?;
println!("{}", result);
Ok(())
}

View File

@@ -1,9 +1,12 @@
use color_eyre::Result;
use {{crate_name}}::part2::process;
use miette::{Context, Result};
#[tracing::instrument]
fn main() -> Result<()> {
tracing_subscriber::fmt::init();
let file = include_str!("../../input2.txt");
let result = process(file)?;
let result = process(file).context("process part 2")?;
println!("{}", result);
Ok(())
}

View File

@@ -1,4 +1,4 @@
use color_eyre::Result;
use miette::Result;
pub fn process(input: &str) -> Result<usize> {
todo!("day xx - part 1");

View File

@@ -1,4 +1,4 @@
use color_eyre::Result;
use miette::Result;
pub fn process(input: &str) -> Result<usize> {
todo!("day xx - part 2");