Files
ElyOffice/crates/ely-platform/src/graphics.rs
T
ZacharyZhang-NY b7fca0146d Ely Office: six offline-first desktop apps in Rust and GPUI
ElyDoc, ElyTable, ElyShow (LibreOfficeKit), ElyPDF (MuPDF), ElyTree (Git),
ElyMark (Milkdown and CodeMirror in CEF). ElyMail and ElyAgent follow.
2026-10-08 21:20:08 -04:00

26 lines
694 B
Rust

use anyhow::Result;
/// Fails when no graphics device exists; probed on macOS only.
pub fn check() -> Result<()> {
#[cfg(target_os = "macos")]
{
let devices = metal::Device::all();
anyhow::ensure!(
!devices.is_empty() || metal::Device::system_default().is_some(),
"no Metal graphics device was found"
);
log::info!("graphics: {} Metal device(s)", devices.len());
}
#[cfg(not(target_os = "macos"))]
log::info!("graphics: the backend is not probed on this OS");
Ok(())
}
#[cfg(all(test, target_os = "macos"))]
mod tests {
#[test]
fn this_mac_has_a_metal_device() {
super::check().unwrap();
}
}