Create a new SubnetIps from the given subnet names and indexes. An IP address is built based on the subnet index, the container index, and the node index.
(
kind: ContainerKind,
subnet_indexes: &[(SubnetName, usize)],
node_index: usize,
)
| 80 | /// Create a new SubnetIps from the given subnet names and indexes. |
| 81 | /// An IP address is built based on the subnet index, the container index, and the node index. |
| 82 | pub fn from( |
| 83 | kind: ContainerKind, |
| 84 | subnet_indexes: &[(SubnetName, usize)], |
| 85 | node_index: usize, |
| 86 | ) -> Self { |
| 87 | let subnets = subnet_indexes |
| 88 | .iter() |
| 89 | .map(|(subnet_name, subnet_index)| { |
| 90 | let ip = Container::build_ip_address(*subnet_index, kind.index(), node_index); |
| 91 | (subnet_name.clone(), ip) |
| 92 | }) |
| 93 | .collect::<IndexMap<_, _>>(); |
| 94 | Self(subnets) |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | impl std::fmt::Display for SubnetIps { |
no test coverage detected