Parses a comma-seperated string of triples of the form protocol:ip:port
(s: String)
| 57 | |
| 58 | // Parses a comma-seperated string of triples of the form protocol:ip:port |
| 59 | fn parse_netlist(s: String) -> Result<Netlist> { |
| 60 | let mut netlist = empty_netlist(); |
| 61 | if s.is_empty() { |
| 62 | return Ok(netlist); |
| 63 | } |
| 64 | for (idx, triple_str) in s.split(',').enumerate() { |
| 65 | if idx >= netlist.len() { |
| 66 | return Err(anyhow!("Too many net endpoints for the allow list")); |
| 67 | }; |
| 68 | netlist[idx] = parse_net_triple(triple_str)?; |
| 69 | } |
| 70 | Ok(netlist) |
| 71 | } |
| 72 | |
| 73 | fn main() { |
| 74 | let matches = App::new("Wave Runner") |
no test coverage detected