use std::fmt;
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, Default)]
pub enum ReductionPolicy {
#[default]
Deterministic,
Fast,
}
impl ReductionPolicy {
#[must_use]
pub const fn is_deterministic(self) -> bool {
matches!(self, Self::Deterministic)
}
#[must_use]
pub const fn name(self) -> &'static str {
match self {
Self::Deterministic => "deterministic",
Self::Fast => "fast",
}
}
}
impl fmt::Display for ReductionPolicy {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
formatter.write_str(self.name())
}
}
#[cfg(test)]
#[path = "policy_tests.rs"]
mod tests;