sycl_rs/info/
device-info.rs1use sycl_rs_sys::device::ffi;
10
11use crate::{
12 device::{Aspect, Device},
13 info::Info,
14 private::Sealed,
15};
16
17pub struct DeviceType;
19impl Sealed for DeviceType {}
20impl Info for DeviceType {
21 type Item = crate::info::DeviceType;
22 type Target = Device;
23 fn get_item(target: &Self::Target) -> Self::Item {
24 ffi::get_device_type(&target.0)
25 }
26}
27
28pub struct Version;
30impl Sealed for Version {}
31impl Info for Version {
32 type Item = String;
33 type Target = Device;
34 fn get_item(target: &Self::Target) -> Self::Item {
35 ffi::get_version(&target.0)
36 }
37}
38
39pub struct Name;
41impl Sealed for Name {}
42impl Info for Name {
43 type Item = String;
44 type Target = Device;
45 fn get_item(target: &Self::Target) -> Self::Item {
46 ffi::get_name(&target.0)
47 }
48}
49
50pub struct PciBdfAddress;
53impl Sealed for PciBdfAddress {}
54impl Info for PciBdfAddress {
55 type Item = String;
56 type Target = Device;
57 fn get_item(target: &Self::Target) -> Self::Item {
58 assert!(
59 target.has(Aspect::ExtIntelPciAddress),
60 "device does not support the Intel PCI address extension"
61 );
62 ffi::get_pci_bdf_address(&target.0)
63 }
64}