Skip to main content

oxilean_codegen/opt_strength/
strengthreducerule_traits.rs

1//! # StrengthReduceRule - Trait Implementations
2//!
3//! This module contains trait implementations for `StrengthReduceRule`.
4//!
5//! ## Implemented Traits
6//!
7//! - `Display`
8//!
9//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
10
11use crate::lcnf::*;
12
13use super::types::StrengthReduceRule;
14use std::fmt;
15
16impl fmt::Display for StrengthReduceRule {
17    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18        match self {
19            StrengthReduceRule::MulByPow2(n) => write!(f, "MulByPow2({})", n),
20            StrengthReduceRule::DivByPow2(n) => write!(f, "DivByPow2({})", n),
21            StrengthReduceRule::ModByPow2(n) => write!(f, "ModByPow2({})", n),
22            StrengthReduceRule::MulByConstant(c) => write!(f, "MulByConstant({})", c),
23            StrengthReduceRule::DivByConstant(c) => write!(f, "DivByConstant({})", c),
24            StrengthReduceRule::Pow2Const => write!(f, "Pow2Const"),
25            StrengthReduceRule::Pow3Const => write!(f, "Pow3Const"),
26            StrengthReduceRule::NegToSub => write!(f, "NegToSub"),
27            StrengthReduceRule::AddSubToInc => write!(f, "AddSubToInc"),
28        }
29    }
30}