aether/pytranspile/
options.rs

1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
2pub enum DecimalMode {
3    /// Treat decimal-like values as fixed precision numbers.
4    FixedPrecision,
5}
6
7#[derive(Debug, Clone, Copy, PartialEq, Eq)]
8pub struct TranspileOptions {
9    /// Hard reject any `numpy` usage.
10    pub reject_numpy: bool,
11    /// Hard reject any filesystem/network usage.
12    pub reject_io: bool,
13    /// Hard reject any console IO (`print` / Aether `PRINT*` / `INPUT`).
14    pub reject_console: bool,
15
16    /// Decimal handling strategy.
17    pub decimal_mode: DecimalMode,
18
19    /// Internal calculation scale (e.g. 6).
20    pub calc_scale: u32,
21    /// Money output scale (e.g. 2 for cents).
22    pub money_scale: u32,
23}
24
25impl Default for TranspileOptions {
26    fn default() -> Self {
27        Self {
28            reject_numpy: true,
29            reject_io: true,
30            reject_console: true,
31            decimal_mode: DecimalMode::FixedPrecision,
32            calc_scale: 6,
33            money_scale: 2,
34        }
35    }
36}