use serde::Serialize;
use std::fmt;
use crate::Mutant;
#[derive(Clone, Eq, PartialEq, Debug, Serialize)]
#[allow(clippy::large_enum_variant)]
pub enum Scenario {
Baseline,
Mutant(Mutant),
}
impl fmt::Display for Scenario {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Scenario::Baseline => f.write_str("baseline"),
Scenario::Mutant(mutant) => f.write_str(&mutant.name(true)),
}
}
}
impl Scenario {
pub fn is_mutant(&self) -> bool {
matches!(self, Scenario::Mutant { .. })
}
pub fn mutant(&self) -> Option<&Mutant> {
match self {
Scenario::Baseline => None,
Scenario::Mutant(mutant) => Some(mutant),
}
}
}