cfx_types/space_util.rs
1use super::{Address, AddressWithSpace, Space};
2
3pub trait AddressSpaceUtil: Sized {
4 fn with_space(self, space: Space) -> AddressWithSpace;
5 fn with_native_space(self) -> AddressWithSpace {
6 self.with_space(Space::Native)
7 }
8 fn with_evm_space(self) -> AddressWithSpace {
9 self.with_space(Space::Ethereum)
10 }
11}
12
13impl AddressSpaceUtil for Address {
14 fn with_space(self, space: Space) -> AddressWithSpace {
15 AddressWithSpace {
16 address: self,
17 space,
18 }
19 }
20}