Build notes string for a sandbox based on active forwards. Returns a string like `fwd:8080,3000` or an empty string if no forwards are active for the given sandbox.
(sandbox_name: &str, forwards: &[ForwardInfo])
| 916 | /// Returns a string like `fwd:8080,3000` or an empty string if no forwards |
| 917 | /// are active for the given sandbox. |
| 918 | pub fn build_sandbox_notes(sandbox_name: &str, forwards: &[ForwardInfo]) -> String { |
| 919 | let ports: Vec<String> = forwards |
| 920 | .iter() |
| 921 | .filter(|f| f.sandbox_name == sandbox_name && f.validated_alive) |
| 922 | .map(|f| f.port.to_string()) |
| 923 | .collect(); |
| 924 | if ports.is_empty() { |
| 925 | String::new() |
| 926 | } else { |
| 927 | format!("fwd:{}", ports.join(",")) |
| 928 | } |
| 929 | } |
| 930 | |
| 931 | // --------------------------------------------------------------------------- |
| 932 | // Tests |
no test coverage detected