adding dhat to day template

This commit is contained in:
Dylan Thies
2024-01-06 11:46:01 -05:00
parent 039f87d762
commit 27613db8f7
2 changed files with 11 additions and 0 deletions

View File

@@ -14,6 +14,10 @@ itertools.workspace = true
log.workspace = true
error-stack.workspace = true
thiserror.workspace = true
dhat.workspace = true
[dev-dependencies]
test-log.workspace = true
[features]
dhat-heap = []

View File

@@ -6,6 +6,10 @@ use {{ crate_name }}::part2;
use error_stack::{Result, ResultExt};
use thiserror::Error;
#[cfg(feature = "dhat-heap")]
#[global_allocator]
static ALLOC: dhat::Alloc = dhat::Alloc;
#[derive(Debug, Error)]
enum {{ project-name | upper_camel_case }}Error {
#[error("Part 1 failed")]
@@ -15,6 +19,9 @@ enum {{ project-name | upper_camel_case }}Error {
}
fn main() -> Result<(), {{ project-name | upper_camel_case }}Error> {
#[cfg(feature = "dhat-heap")]
let _profiler = dhat::Profiler::new_heap();
let input = include_str!("./input.txt");
let part1_result = part1(input).change_context({{ project-name | upper_camel_case }}Error::Part1Error)?;
println!("part 1: {part1_result}");