You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
advent-of-code/2016/rust/src/main.rs

30 lines
510 B

use std::io;
use std::io::Read;
extern crate advent_of_code_2016;
use advent_of_code_2016::*;
use advent_of_code_2016::errors::*;
fn main() {
run(|| {
let mut input = String::new();
io::stdin().read_to_string(&mut input).ok();
let solution = day_23::solve(&input)?;
println!("{}", solution);
Ok(())
});
}
fn run<F>(f: F)
where F: Fn() -> Result<()>
{
if let Err(error) = f() {
for error in error.iter() {
println!("{}", error);
}
std::process::exit(1);
}
}