1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#![deny(clippy::pedantic)]
#![feature(unwrap_infallible)]
#![feature(split_array)]
#![feature(result_flattening)]

#[macro_use]
extern crate serde_derive_state;

#[macro_use]
extern crate log;

use anyhow::{Context, Result};
use clap::Parser;

mod args;
mod cli;
mod minimal_logger;
mod reporter;

use args::cli::RustcoalescenceArgs;
use minimal_logger::MinimalLogger;

static MINIMAL_LOGGER: MinimalLogger = MinimalLogger;

fn main() -> Result<()> {
    // Set up the minimal logger to stdout/stderr
    log::set_logger(&MINIMAL_LOGGER)?;
    log::set_max_level(log::LevelFilter::Info);

    // Parse and validate all command line arguments
    let args = RustcoalescenceArgs::parse();

    match args {
        RustcoalescenceArgs::Simulate(simulate_args) => {
            cli::simulate::simulate_with_logger(simulate_args)
                .context("Failed to initialise or perform the simulation.")
        },
        RustcoalescenceArgs::Replay(replay_args) => {
            cli::replay::replay_with_logger(replay_args).context("Failed to replay the simulation.")
        },
    }
}