use sycl_rs_sys::device::ffi;
use crate::{info::InfoTarget, platform::Platform, private::Sealed};
pub struct Device(pub(crate) cxx::UniquePtr<ffi::Device>);
impl Sealed for Device {}
impl InfoTarget for Device {}
impl From<cxx::UniquePtr<ffi::Device>> for Device {
fn from(value: cxx::UniquePtr<ffi::Device>) -> Self {
Self(value)
}
}
impl Device {
pub fn get_devices() -> Vec<Self> {
ffi::get_devices()
.into_iter()
.map(|device| Self(device.ptr))
.collect()
}
pub fn get_platform(&self) -> Platform {
let raw_platform = ffi::get_platform(&self.0);
Platform(raw_platform)
}
}
impl Clone for Device {
fn clone(&self) -> Self {
ffi::clone(&self.0).into()
}
}