pub fn copy_all_devices_with_observer<F>(
handler: F,
) -> (Vec<Device>, DeviceObserver)Expand description
Copy all devices with an observer for hot-plug notifications (macOS only).
This function returns all available devices and sets up an observer that will be notified when devices are added or removed.
C++ equivalent: NS::Array* MTL::CopyAllDevicesWithObserver(NS::Object**, handler)
§Example
ⓘ
use mtl_gpu::device;
let (devices, observer) = device::copy_all_devices_with_observer(|device, notification| {
println!("Device event: {:?}", notification);
});
// ... use devices ...
// When done observing:
device::remove_device_observer(observer);