MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / new

Method new

crates/openshell-core/src/gpu.rs:73–85  ·  view source on GitHub ↗
(device_ids: impl IntoIterator<Item = impl AsRef<str>>)

Source from the content-addressed store, hash-verified

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] {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected