anychain_ton/
format.rs

1use {
2    anychain_core::Format,
3    core::{default::Default, fmt},
4};
5
6#[derive(Default, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
7pub enum TonFormat {
8    MainnetBounceable, // non_bounceable = false, non_production = false
9    TestnetBounceable, // non_bounceable = false, non_production = true
10    #[default]
11    MainnetNonBounceable, // non_bounceable = true, non_production = false
12    TestnetNonBounceable, // non_bounceable = true, non_production = true
13}
14
15impl Format for TonFormat {}
16
17impl fmt::Display for TonFormat {
18    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
19        match self {
20            TonFormat::MainnetBounceable => write!(f, "MainnetBounceable"),
21            TonFormat::TestnetBounceable => write!(f, "TestnetBounceable"),
22            TonFormat::MainnetNonBounceable => write!(f, "MainnetNonBounceable"),
23            TonFormat::TestnetNonBounceable => write!(f, "TestnetNonBounceable"),
24        }
25    }
26}
27
28#[cfg(test)]
29mod tests {
30    use super::*;
31
32    #[test]
33    fn test_display() {
34        assert_eq!(
35            TonFormat::MainnetBounceable.to_string(),
36            "MainnetBounceable"
37        );
38        assert_eq!(
39            TonFormat::TestnetBounceable.to_string(),
40            "TestnetBounceable"
41        );
42        assert_eq!(
43            TonFormat::MainnetNonBounceable.to_string(),
44            "MainnetNonBounceable"
45        );
46        assert_eq!(
47            TonFormat::TestnetNonBounceable.to_string(),
48            "TestnetNonBounceable"
49        );
50    }
51}