(device_ids: impl IntoIterator<Item = impl AsRef<str>>)
| 71 | /// Build a normalized inventory from runtime-reported CDI device IDs. |
| 72 | #[must_use] |
| 73 | pub fn new(device_ids: impl IntoIterator<Item = impl AsRef<str>>) -> Self { |
| 74 | let mut device_ids = device_ids |
| 75 | .into_iter() |
| 76 | .filter_map(|id| { |
| 77 | let id = id.as_ref().trim(); |
| 78 | id.starts_with(CDI_NVIDIA_GPU_PREFIX) |
| 79 | .then(|| id.to_string()) |
| 80 | }) |
| 81 | .collect::<Vec<_>>(); |
| 82 | device_ids.sort(); |
| 83 | device_ids.dedup(); |
| 84 | Self { device_ids } |
| 85 | } |
| 86 | |
| 87 | #[must_use] |
| 88 | pub fn as_slice(&self) -> &[String] { |
nothing calls this directly
no outgoing calls
no test coverage detected