oneapi_rs/info/
device-info.rs

1//
2// Copyright (C) 2026 Intel Corporation
3//
4// Under the MIT License or the Apache License v2.0.
5// See LICENSE-MIT and LICENSE-APACHE for license information.
6// SPDX-License-Identifier: MIT OR Apache-2.0
7//
8
9use crate::device::Device;
10use crate::info::Info;
11use crate::private::Sealed;
12use oneapi_rs_sys::device::ffi;
13
14/// Returns the device type associated with the device. May not return `oneapi_rs::info::DeviceType::All`
15pub struct DeviceType;
16impl Sealed for DeviceType {}
17impl Info for DeviceType {
18    type Item = crate::info::DeviceType;
19    type Target = Device;
20    fn get_item(target: &Self::Target) -> Self::Item {
21        ffi::get_device_type(&target.0)
22    }
23}
24
25/// Returns a backend-defined device version.
26pub struct Version;
27impl Sealed for Version {}
28impl Info for Version {
29    type Item = String;
30    type Target = Device;
31    fn get_item(target: &Self::Target) -> Self::Item {
32        ffi::get_version(&target.0)
33    }
34}
35
36/// Returns the device name of this SYCL device.
37pub struct Name;
38impl Sealed for Name {}
39impl Info for Name {
40    type Item = String;
41    type Target = Device;
42    fn get_item(target: &Self::Target) -> Self::Item {
43        ffi::get_name(&target.0)
44    }
45}