1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use std::fmt;

pub enum AddressType {
    Receive = 0,
    Change,
}

impl fmt::Display for AddressType {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            Self::Receive => write!(f, "Receive"),
            Self::Change => write!(f, "Change"),
        }
    }
}

impl AddressType {
    pub fn index(&self) -> u32 {
        match self {
            Self::Receive => 0,
            Self::Change => 1,
        }
    }
}