refactor: make some template modules private
This commit is contained in:
parent
e2ece20754
commit
8f1fb65360
5 changed files with 8 additions and 10 deletions
|
@ -11,7 +11,6 @@ pub enum AocCommandError {
|
||||||
CommandNotFound,
|
CommandNotFound,
|
||||||
CommandNotCallable,
|
CommandNotCallable,
|
||||||
BadExitStatus(Output),
|
BadExitStatus(Output),
|
||||||
IoError,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for AocCommandError {
|
impl Display for AocCommandError {
|
||||||
|
@ -22,7 +21,6 @@ impl Display for AocCommandError {
|
||||||
AocCommandError::BadExitStatus(_) => {
|
AocCommandError::BadExitStatus(_) => {
|
||||||
write!(f, "aoc-cli exited with a non-zero status.")
|
write!(f, "aoc-cli exited with a non-zero status.")
|
||||||
}
|
}
|
||||||
AocCommandError::IoError => write!(f, "could not write output files to file system."),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,15 @@ use std::{env, fs};
|
||||||
|
|
||||||
pub mod aoc_cli;
|
pub mod aoc_cli;
|
||||||
pub mod commands;
|
pub mod commands;
|
||||||
mod day;
|
|
||||||
pub mod readme_benchmarks;
|
|
||||||
pub mod run_multi;
|
|
||||||
pub mod runner;
|
pub mod runner;
|
||||||
pub mod timings;
|
|
||||||
|
|
||||||
pub use day::*;
|
pub use day::*;
|
||||||
|
|
||||||
|
mod day;
|
||||||
|
mod readme_benchmarks;
|
||||||
|
mod run_multi;
|
||||||
|
mod timings;
|
||||||
|
|
||||||
pub const ANSI_ITALIC: &str = "\x1b[3m";
|
pub const ANSI_ITALIC: &str = "\x1b[3m";
|
||||||
pub const ANSI_BOLD: &str = "\x1b[1m";
|
pub const ANSI_BOLD: &str = "\x1b[1m";
|
||||||
pub const ANSI_RESET: &str = "\x1b[0m";
|
pub const ANSI_RESET: &str = "\x1b[0m";
|
||||||
|
|
|
@ -48,7 +48,6 @@ pub fn run_multi(days_to_run: HashSet<Day>, is_release: bool, is_timed: bool) ->
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
BrokenPipe,
|
BrokenPipe,
|
||||||
Parser(String),
|
|
||||||
IO(io::Error),
|
IO(io::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/// Encapsulates code that interacts with solution functions.
|
/// Encapsulates code that interacts with solution functions.
|
||||||
use crate::template::{aoc_cli, Day, ANSI_ITALIC, ANSI_RESET};
|
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
use std::hint::black_box;
|
use std::hint::black_box;
|
||||||
use std::io::{stdout, Write};
|
use std::io::{stdout, Write};
|
||||||
|
@ -7,7 +6,8 @@ use std::process::Output;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
use std::{cmp, env, process};
|
use std::{cmp, env, process};
|
||||||
|
|
||||||
use super::ANSI_BOLD;
|
use crate::template::ANSI_BOLD;
|
||||||
|
use crate::template::{aoc_cli, Day, ANSI_ITALIC, ANSI_RESET};
|
||||||
|
|
||||||
pub fn run_part<I: Clone, T: Display>(func: impl Fn(I) -> Option<T>, input: I, day: Day, part: u8) {
|
pub fn run_part<I: Clone, T: Display>(func: impl Fn(I) -> Option<T>, input: I, day: Day, part: u8) {
|
||||||
let part_str = format!("Part {part}");
|
let part_str = format!("Part {part}");
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use std::{collections::HashMap, fs, io::Error, str::FromStr};
|
use std::{collections::HashMap, fs, io::Error, str::FromStr};
|
||||||
use tinyjson::JsonValue;
|
use tinyjson::JsonValue;
|
||||||
|
|
||||||
use super::Day;
|
use crate::template::Day;
|
||||||
|
|
||||||
static TIMINGS_FILE_PATH: &str = "./data/timings.json";
|
static TIMINGS_FILE_PATH: &str = "./data/timings.json";
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue