mirror of
https://github.com/anthonyoteri/advent-of-code-2023.git
synced 2026-06-05 19:56:53 -04:00
Add skeleton project
Signed-off-by: Anthony Oteri <anthony.oteri@gmail.com>
This commit is contained in:
+32
@@ -0,0 +1,32 @@
|
|||||||
|
[workspace]
|
||||||
|
resolver = "2"
|
||||||
|
members = ["day-*"]
|
||||||
|
|
||||||
|
[workspace.dependencies]
|
||||||
|
glam = "0.24.2"
|
||||||
|
indicatif = { version = "0.17.7", features = ["rayon"] }
|
||||||
|
itertools = "0.12.0"
|
||||||
|
nom = "7.1.3"
|
||||||
|
rayon = "1.8.0"
|
||||||
|
tracing = "0.1.40"
|
||||||
|
tracing-subscriber = "0.3.18"
|
||||||
|
rstest = "0.18.2"
|
||||||
|
retest_reuse = "0.6.0"
|
||||||
|
divan = "0.1.3"
|
||||||
|
tracing-tracy = "0.10.4"
|
||||||
|
tracy-client = "0.16.4"
|
||||||
|
tracy-client-sys = "0.22.0"
|
||||||
|
miette = { version = "5.10", features = ["fancy"] }
|
||||||
|
thiserror = "1.0.50"
|
||||||
|
dhat = "0.3.2"
|
||||||
|
env_logger = "0.10.1"
|
||||||
|
test-log = "0.2.13"
|
||||||
|
|
||||||
|
|
||||||
|
[profile.flamegraph]
|
||||||
|
inherits = "release"
|
||||||
|
debug = true
|
||||||
|
|
||||||
|
[profile.dhat]
|
||||||
|
inherits = "release"
|
||||||
|
debug = 1
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
[package]
|
||||||
|
name = "day-00"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
itertools = { workspace = true }
|
||||||
|
nom = { workspace = true }
|
||||||
|
tracing = { workspace = true }
|
||||||
|
tracing-subscriber = { workspace = true }
|
||||||
|
miette = { workspace = true }
|
||||||
|
thiserror = { workspace = true }
|
||||||
|
dhat = { workspace = true }
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
divan = { workspace = true }
|
||||||
|
env_logger = { workspace = true }
|
||||||
|
test-log = { workspace = true }
|
||||||
|
|
||||||
|
[[bench]]
|
||||||
|
name = "day-00"
|
||||||
|
path = "benches/benchmark.rs"
|
||||||
|
harness = false
|
||||||
|
|
||||||
|
[features]
|
||||||
|
dhat-heap = []
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
use day_00::*;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
divan::main();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[divan::bench]
|
||||||
|
fn part1() {
|
||||||
|
part1::process(divan::black_box("../input.txt")).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[divan::bench]
|
||||||
|
fn part2() {
|
||||||
|
part2::process(divan::black_box("../input.txt")).unwrap();
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
use day_00::part1::process;
|
||||||
|
use miette::Context;
|
||||||
|
|
||||||
|
#[cfg(feature = "dhat-heap")]
|
||||||
|
#[global_allocator]
|
||||||
|
static ALLOC: dhat::Alloc = dhat::Alloc;
|
||||||
|
|
||||||
|
#[tracing::instrument]
|
||||||
|
fn main() -> miette::Result<()> {
|
||||||
|
#[cfg(feature = "dhat-heap")]
|
||||||
|
let _profiler = dhat::Profiler::new_heap();
|
||||||
|
|
||||||
|
#[cfg(not(feature = "dhat-heap"))]
|
||||||
|
tracing_subscriber::fmt::init();
|
||||||
|
|
||||||
|
let file = include_str!("../../input.txt");
|
||||||
|
let result = process(file).context("process part 1")?;
|
||||||
|
|
||||||
|
println!("{}", result);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
use day_00::part2::process;
|
||||||
|
use miette::Context;
|
||||||
|
|
||||||
|
#[cfg(feature = "dhat-heap")]
|
||||||
|
#[global_allocator]
|
||||||
|
static ALLOC: dhat::Alloc = dhat::Alloc;
|
||||||
|
|
||||||
|
#[tracing::instrument]
|
||||||
|
fn main() -> miette::Result<()> {
|
||||||
|
#[cfg(feature = "dhat-heap")]
|
||||||
|
let _profiler = dhat::Profiler::new_heap();
|
||||||
|
|
||||||
|
#[cfg(not(feature = "dhat-heap"))]
|
||||||
|
tracing_subscriber::fmt::init();
|
||||||
|
|
||||||
|
let file = include_str!("../../input.txt");
|
||||||
|
let result = process(file).context("process part 1")?;
|
||||||
|
|
||||||
|
println!("{}", result);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
use miette::Diagnostic;
|
||||||
|
use thiserror::Error;
|
||||||
|
|
||||||
|
#[derive(Error, Diagnostic, Debug)]
|
||||||
|
pub enum AocError {
|
||||||
|
#[error(transparent)]
|
||||||
|
#[diagnostic(code(aoc::io_error))]
|
||||||
|
IoError(#[from] std::io::Error),
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
pub mod error;
|
||||||
|
|
||||||
|
pub mod part1;
|
||||||
|
pub mod part2;
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
use crate::error::AocError;
|
||||||
|
|
||||||
|
#[tracing::instrument]
|
||||||
|
pub fn process(input: &str) -> miette::Result<u64, AocError> {
|
||||||
|
Ok(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test_log::test]
|
||||||
|
fn test_process() -> miette::Result<()> {
|
||||||
|
let input = include_str!("../test-input.txt");
|
||||||
|
assert_eq!(0, process(input)?);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
use crate::error::AocError;
|
||||||
|
|
||||||
|
#[tracing::instrument]
|
||||||
|
pub fn process(input: &str) -> miette::Result<u64, AocError> {
|
||||||
|
Ok(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test_log::test]
|
||||||
|
fn test_process() -> miette::Result<()> {
|
||||||
|
let input = include_str!("../test-input.txt");
|
||||||
|
assert_eq!(0, process(input)?);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user