()
| 79 | } |
| 80 | |
| 81 | fn local_host_name() -> String { |
| 82 | platform_host_name() |
| 83 | .and_then(|value| { |
| 84 | value |
| 85 | .trim() |
| 86 | .trim_end_matches(".local") |
| 87 | .trim_end_matches('.') |
| 88 | .split('.') |
| 89 | .next() |
| 90 | .filter(|value| !value.is_empty()) |
| 91 | .map(ToOwned::to_owned) |
| 92 | }) |
| 93 | .unwrap_or_else(|| "localhost".to_owned()) |
| 94 | } |
| 95 | |
| 96 | #[cfg(unix)] |
| 97 | fn platform_host_name() -> Option<String> { |
no test coverage detected