Skip to main content

oneapi_rs/info/
platform-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::platform::Platform;
10use oneapi_rs_sys::platform::ffi;
11
12pub trait PlatformInfo {
13    type Item;
14    fn get_item(platform: &Platform) -> Self::Item;
15}
16
17/// Returns a backend-defined platform version.
18pub struct Version;
19impl PlatformInfo for Version {
20    type Item = String;
21    fn get_item(platform: &Platform) -> Self::Item {
22        ffi::get_version(&platform.0)
23    }
24}
25
26/// Returns the name of the platform.
27pub struct Name;
28impl PlatformInfo for Name {
29    type Item = String;
30    fn get_item(platform: &Platform) -> Self::Item {
31        ffi::get_name(&platform.0)
32    }
33}
34
35/// Returns the name of the vendor providing the platform.
36pub struct Vendor;
37impl PlatformInfo for Vendor {
38    type Item = String;
39    fn get_item(platform: &Platform) -> Self::Item {
40        ffi::get_vendor(&platform.0)
41    }
42}