Advent of Code for 2025!

infra: Set up day runner

+2
.gitignore
··· 1 + /inputs 2 + /target
+333
Cargo.lock
··· 1 + # This file is automatically @generated by Cargo. 2 + # It is not intended for manual editing. 3 + version = 4 4 + 5 + [[package]] 6 + name = "anyhow" 7 + version = "1.0.100" 8 + source = "registry+https://github.com/rust-lang/crates.io-index" 9 + checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" 10 + 11 + [[package]] 12 + name = "aoc2025" 13 + version = "0.1.0" 14 + dependencies = [ 15 + "anyhow", 16 + "proptest", 17 + ] 18 + 19 + [[package]] 20 + name = "autocfg" 21 + version = "1.5.0" 22 + source = "registry+https://github.com/rust-lang/crates.io-index" 23 + checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" 24 + 25 + [[package]] 26 + name = "bit-set" 27 + version = "0.8.0" 28 + source = "registry+https://github.com/rust-lang/crates.io-index" 29 + checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" 30 + dependencies = [ 31 + "bit-vec", 32 + ] 33 + 34 + [[package]] 35 + name = "bit-vec" 36 + version = "0.8.0" 37 + source = "registry+https://github.com/rust-lang/crates.io-index" 38 + checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" 39 + 40 + [[package]] 41 + name = "bitflags" 42 + version = "2.10.0" 43 + source = "registry+https://github.com/rust-lang/crates.io-index" 44 + checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" 45 + 46 + [[package]] 47 + name = "cfg-if" 48 + version = "1.0.4" 49 + source = "registry+https://github.com/rust-lang/crates.io-index" 50 + checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" 51 + 52 + [[package]] 53 + name = "errno" 54 + version = "0.3.14" 55 + source = "registry+https://github.com/rust-lang/crates.io-index" 56 + checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" 57 + dependencies = [ 58 + "libc", 59 + "windows-sys", 60 + ] 61 + 62 + [[package]] 63 + name = "fastrand" 64 + version = "2.3.0" 65 + source = "registry+https://github.com/rust-lang/crates.io-index" 66 + checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" 67 + 68 + [[package]] 69 + name = "fnv" 70 + version = "1.0.7" 71 + source = "registry+https://github.com/rust-lang/crates.io-index" 72 + checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 73 + 74 + [[package]] 75 + name = "getrandom" 76 + version = "0.3.4" 77 + source = "registry+https://github.com/rust-lang/crates.io-index" 78 + checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" 79 + dependencies = [ 80 + "cfg-if", 81 + "libc", 82 + "r-efi", 83 + "wasip2", 84 + ] 85 + 86 + [[package]] 87 + name = "libc" 88 + version = "0.2.177" 89 + source = "registry+https://github.com/rust-lang/crates.io-index" 90 + checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" 91 + 92 + [[package]] 93 + name = "linux-raw-sys" 94 + version = "0.11.0" 95 + source = "registry+https://github.com/rust-lang/crates.io-index" 96 + checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" 97 + 98 + [[package]] 99 + name = "num-traits" 100 + version = "0.2.19" 101 + source = "registry+https://github.com/rust-lang/crates.io-index" 102 + checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" 103 + dependencies = [ 104 + "autocfg", 105 + ] 106 + 107 + [[package]] 108 + name = "once_cell" 109 + version = "1.21.3" 110 + source = "registry+https://github.com/rust-lang/crates.io-index" 111 + checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" 112 + 113 + [[package]] 114 + name = "ppv-lite86" 115 + version = "0.2.21" 116 + source = "registry+https://github.com/rust-lang/crates.io-index" 117 + checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" 118 + dependencies = [ 119 + "zerocopy", 120 + ] 121 + 122 + [[package]] 123 + name = "proc-macro2" 124 + version = "1.0.103" 125 + source = "registry+https://github.com/rust-lang/crates.io-index" 126 + checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" 127 + dependencies = [ 128 + "unicode-ident", 129 + ] 130 + 131 + [[package]] 132 + name = "proptest" 133 + version = "1.9.0" 134 + source = "registry+https://github.com/rust-lang/crates.io-index" 135 + checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" 136 + dependencies = [ 137 + "bit-set", 138 + "bit-vec", 139 + "bitflags", 140 + "num-traits", 141 + "rand", 142 + "rand_chacha", 143 + "rand_xorshift", 144 + "regex-syntax", 145 + "rusty-fork", 146 + "tempfile", 147 + "unarray", 148 + ] 149 + 150 + [[package]] 151 + name = "quick-error" 152 + version = "1.2.3" 153 + source = "registry+https://github.com/rust-lang/crates.io-index" 154 + checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" 155 + 156 + [[package]] 157 + name = "quote" 158 + version = "1.0.42" 159 + source = "registry+https://github.com/rust-lang/crates.io-index" 160 + checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" 161 + dependencies = [ 162 + "proc-macro2", 163 + ] 164 + 165 + [[package]] 166 + name = "r-efi" 167 + version = "5.3.0" 168 + source = "registry+https://github.com/rust-lang/crates.io-index" 169 + checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" 170 + 171 + [[package]] 172 + name = "rand" 173 + version = "0.9.2" 174 + source = "registry+https://github.com/rust-lang/crates.io-index" 175 + checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" 176 + dependencies = [ 177 + "rand_chacha", 178 + "rand_core", 179 + ] 180 + 181 + [[package]] 182 + name = "rand_chacha" 183 + version = "0.9.0" 184 + source = "registry+https://github.com/rust-lang/crates.io-index" 185 + checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" 186 + dependencies = [ 187 + "ppv-lite86", 188 + "rand_core", 189 + ] 190 + 191 + [[package]] 192 + name = "rand_core" 193 + version = "0.9.3" 194 + source = "registry+https://github.com/rust-lang/crates.io-index" 195 + checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" 196 + dependencies = [ 197 + "getrandom", 198 + ] 199 + 200 + [[package]] 201 + name = "rand_xorshift" 202 + version = "0.4.0" 203 + source = "registry+https://github.com/rust-lang/crates.io-index" 204 + checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" 205 + dependencies = [ 206 + "rand_core", 207 + ] 208 + 209 + [[package]] 210 + name = "regex-syntax" 211 + version = "0.8.8" 212 + source = "registry+https://github.com/rust-lang/crates.io-index" 213 + checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" 214 + 215 + [[package]] 216 + name = "rustix" 217 + version = "1.1.2" 218 + source = "registry+https://github.com/rust-lang/crates.io-index" 219 + checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" 220 + dependencies = [ 221 + "bitflags", 222 + "errno", 223 + "libc", 224 + "linux-raw-sys", 225 + "windows-sys", 226 + ] 227 + 228 + [[package]] 229 + name = "rusty-fork" 230 + version = "0.3.1" 231 + source = "registry+https://github.com/rust-lang/crates.io-index" 232 + checksum = "cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2" 233 + dependencies = [ 234 + "fnv", 235 + "quick-error", 236 + "tempfile", 237 + "wait-timeout", 238 + ] 239 + 240 + [[package]] 241 + name = "syn" 242 + version = "2.0.111" 243 + source = "registry+https://github.com/rust-lang/crates.io-index" 244 + checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" 245 + dependencies = [ 246 + "proc-macro2", 247 + "quote", 248 + "unicode-ident", 249 + ] 250 + 251 + [[package]] 252 + name = "tempfile" 253 + version = "3.23.0" 254 + source = "registry+https://github.com/rust-lang/crates.io-index" 255 + checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" 256 + dependencies = [ 257 + "fastrand", 258 + "getrandom", 259 + "once_cell", 260 + "rustix", 261 + "windows-sys", 262 + ] 263 + 264 + [[package]] 265 + name = "unarray" 266 + version = "0.1.4" 267 + source = "registry+https://github.com/rust-lang/crates.io-index" 268 + checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" 269 + 270 + [[package]] 271 + name = "unicode-ident" 272 + version = "1.0.22" 273 + source = "registry+https://github.com/rust-lang/crates.io-index" 274 + checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" 275 + 276 + [[package]] 277 + name = "wait-timeout" 278 + version = "0.2.1" 279 + source = "registry+https://github.com/rust-lang/crates.io-index" 280 + checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" 281 + dependencies = [ 282 + "libc", 283 + ] 284 + 285 + [[package]] 286 + name = "wasip2" 287 + version = "1.0.1+wasi-0.2.4" 288 + source = "registry+https://github.com/rust-lang/crates.io-index" 289 + checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" 290 + dependencies = [ 291 + "wit-bindgen", 292 + ] 293 + 294 + [[package]] 295 + name = "windows-link" 296 + version = "0.2.1" 297 + source = "registry+https://github.com/rust-lang/crates.io-index" 298 + checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" 299 + 300 + [[package]] 301 + name = "windows-sys" 302 + version = "0.61.2" 303 + source = "registry+https://github.com/rust-lang/crates.io-index" 304 + checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" 305 + dependencies = [ 306 + "windows-link", 307 + ] 308 + 309 + [[package]] 310 + name = "wit-bindgen" 311 + version = "0.46.0" 312 + source = "registry+https://github.com/rust-lang/crates.io-index" 313 + checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" 314 + 315 + [[package]] 316 + name = "zerocopy" 317 + version = "0.8.31" 318 + source = "registry+https://github.com/rust-lang/crates.io-index" 319 + checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3" 320 + dependencies = [ 321 + "zerocopy-derive", 322 + ] 323 + 324 + [[package]] 325 + name = "zerocopy-derive" 326 + version = "0.8.31" 327 + source = "registry+https://github.com/rust-lang/crates.io-index" 328 + checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" 329 + dependencies = [ 330 + "proc-macro2", 331 + "quote", 332 + "syn", 333 + ]
+10
Cargo.toml
··· 1 + [package] 2 + name = "aoc2025" 3 + version = "0.1.0" 4 + edition = "2024" 5 + 6 + [dependencies] 7 + anyhow = "1.0.100" 8 + 9 + [dev-dependencies] 10 + proptest = "1.9.0"
+114
bacon.toml
··· 1 + # This is a configuration file for the bacon tool 2 + # 3 + # Complete help on configuration: https://dystroy.org/bacon/config/ 4 + # 5 + # You may check the current default at 6 + # https://github.com/Canop/bacon/blob/main/defaults/default-bacon.toml 7 + 8 + default_job = "check" 9 + env.CARGO_TERM_COLOR = "always" 10 + 11 + [jobs.check] 12 + command = ["cargo", "check"] 13 + need_stdout = false 14 + 15 + [jobs.check-all] 16 + command = ["cargo", "check", "--all-targets"] 17 + need_stdout = false 18 + 19 + # Run clippy on the default target 20 + [jobs.clippy] 21 + command = ["cargo", "clippy"] 22 + need_stdout = false 23 + 24 + # Run clippy on all targets 25 + # To disable some lints, you may change the job this way: 26 + # [jobs.clippy-all] 27 + # command = [ 28 + # "cargo", "clippy", 29 + # "--all-targets", 30 + # "--", 31 + # "-A", "clippy::bool_to_int_with_if", 32 + # "-A", "clippy::collapsible_if", 33 + # "-A", "clippy::derive_partial_eq_without_eq", 34 + # ] 35 + # need_stdout = false 36 + [jobs.clippy-all] 37 + command = ["cargo", "clippy", "--all-targets"] 38 + need_stdout = false 39 + 40 + # This job lets you run 41 + # - all tests: bacon test 42 + # - a specific test: bacon test -- config::test_default_files 43 + # - the tests of a package: bacon test -- -- -p config 44 + [jobs.test] 45 + command = ["cargo", "test"] 46 + need_stdout = true 47 + 48 + [jobs.nextest] 49 + command = [ 50 + "cargo", "nextest", "run", 51 + "--hide-progress-bar", "--failure-output", "final" 52 + ] 53 + need_stdout = true 54 + analyzer = "nextest" 55 + 56 + [jobs.doc] 57 + command = ["cargo", "doc", "--no-deps"] 58 + need_stdout = false 59 + 60 + # If the doc compiles, then it opens in your browser and bacon switches 61 + # to the previous job 62 + [jobs.doc-open] 63 + command = ["cargo", "doc", "--no-deps", "--open"] 64 + need_stdout = false 65 + on_success = "back" # so that we don't open the browser at each change 66 + 67 + # You can run your application and have the result displayed in bacon, 68 + # if it makes sense for this crate. 69 + [jobs.run] 70 + command = [ 71 + "cargo", "run", 72 + # put launch parameters for your program behind a `--` separator 73 + ] 74 + need_stdout = true 75 + allow_warnings = true 76 + background = true 77 + 78 + # Run your long-running application (eg server) and have the result displayed in bacon. 79 + # For programs that never stop (eg a server), `background` is set to false 80 + # to have the cargo run output immediately displayed instead of waiting for 81 + # program's end. 82 + # 'on_change_strategy' is set to `kill_then_restart` to have your program restart 83 + # on every change (an alternative would be to use the 'F5' key manually in bacon). 84 + # If you often use this job, it makes sense to override the 'r' key by adding 85 + # a binding `r = job:run-long` at the end of this file . 86 + # A custom kill command such as the one suggested below is frequently needed to kill 87 + # long running programs (uncomment it if you need it) 88 + [jobs.run-long] 89 + command = [ 90 + "cargo", "run", 91 + # put launch parameters for your program behind a `--` separator 92 + ] 93 + need_stdout = true 94 + allow_warnings = true 95 + background = false 96 + on_change_strategy = "kill_then_restart" 97 + # kill = ["pkill", "-TERM", "-P"] 98 + 99 + # This parameterized job runs the example of your choice, as soon 100 + # as the code compiles. 101 + # Call it as 102 + # bacon ex -- my-example 103 + [jobs.ex] 104 + command = ["cargo", "test", "--example"] 105 + need_stdout = true 106 + allow_warnings = true 107 + 108 + # You may define here keybindings that would be specific to 109 + # a project, for example a shortcut to launch a specific job. 110 + # Shortcuts to internal functions (scrolling, toggling, etc.) 111 + # should go in your personal global prefs.toml file instead. 112 + [keybindings] 113 + # alt-m = "job:my-job" 114 + c = "job:clippy-all" # comment this to have 'c' run clippy on only the default target
+33
src/lib.rs
··· 1 + use std::{fmt::Display, fs, time::Instant}; 2 + 3 + use anyhow::Result; 4 + 5 + pub fn run<T, U, V, P, F1, F2>(name: &str, path: &str, parse: P, part1: F1, part2: F2) -> Result<()> 6 + where 7 + T: Clone, 8 + U: Display, 9 + V: Display, 10 + P: Fn(&str) -> T, 11 + F1: Fn(T) -> U, 12 + F2: Fn(T) -> V, 13 + { 14 + println!("{}\n{}\n", name, "-".repeat(name.len())); 15 + 16 + let read_timer = Instant::now(); 17 + let input = fs::read_to_string(path)?; 18 + println!("Read input in: {:?}", read_timer.elapsed()); 19 + 20 + let parse_timer = Instant::now(); 21 + let input = parse(&input); 22 + println!("Parsed input in: {:?}\n", parse_timer.elapsed()); 23 + 24 + let part1_timer = Instant::now(); 25 + println!("Part 1 answer: {}", part1(input.clone())); 26 + println!("Finished in: {:?}\n", part1_timer.elapsed()); 27 + 28 + let part2_timer = Instant::now(); 29 + println!("Part 2 answer: {}", part2(input.clone())); 30 + println!("Finished in: {:?}", part2_timer.elapsed()); 31 + 32 + Ok(()) 33 + }