Skip to main content

aoc_runtime/
lib.rs

1//! The engine behind the `aoc` command line tool.
2//!
3//! The binary is a thin shell around this library: it parses arguments, loads
4//! configuration and hands a [`resolve::Plan`] to [`app::App`]. Everything that
5//! touches the outside world - the clock, child processes, the Advent of Code
6//! API and the terminal - sits behind a trait, so the interesting logic is
7//! exercised in tests without a network, a toolchain or a wall clock.
8//!
9//! ```no_run
10//! use aoc_runtime::{
11//!     app::App, cli::Cli, config::Config, env::{Env, SystemClock},
12//!     aoc::{cache::FileCache, input::InputStore},
13//!     process::SystemRunner, report::TermReporter, resolve,
14//! };
15//! use clap::Parser as _;
16//!
17//! let cli = Cli::parse();
18//! let env = Env::capture(cli.config.as_deref())?;
19//! let (config, _warnings) = Config::load(&env)?;
20//! let plan = resolve::plan(&cli, &config, &env.cwd, &SystemClock)?;
21//! let cache = FileCache::new(&env.state_dir);
22//! let inputs = InputStore::new(&env.state_dir);
23//!
24//! App {
25//!     config: &config,
26//!     runner: &SystemRunner,
27//!     client: None,
28//!     cache: &cache,
29//!     inputs: &inputs,
30//!     reporter: &mut TermReporter,
31//! }
32//! .execute(plan)?;
33//! # Ok::<(), aoc_runtime::error::Error>(())
34//! ```
35
36pub mod answer;
37pub mod aoc;
38pub mod app;
39pub mod cli;
40pub mod config;
41pub mod env;
42pub mod error;
43pub mod language;
44pub mod process;
45pub mod puzzle;
46pub mod report;
47pub mod resolve;
48pub mod template;