use crate::binary::IBinary;
use crate::device::IDevice;
#[cfg(feature = "cuda")]
use crate::frameworks::cuda::DriverError as CudaError;
use crate::hardware::IHardware;
#[cfg(feature = "opencl")]
use frameworks::opencl::Error as OpenCLError;
pub trait IFramework {
type H: IHardware;
type D: IDevice + Clone;
type B: IBinary + Clone;
#[allow(non_snake_case)]
fn ID() -> &'static str;
fn new() -> Self
where
Self: Sized;
fn load_hardwares() -> Result<Vec<Self::H>, Error>;
fn hardwares(&self) -> &[Self::H];
fn binary(&self) -> &Self::B;
fn new_device(&self, _: &[Self::H]) -> Result<Self::D, Error>;
}
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[cfg_attr(feature = "opencl", error(transparent))]
#[cfg(feature = "opencl")]
OpenCL(#[from] OpenCLError),
#[cfg_attr(feature = "cuda", error(transparent))]
#[cfg(feature = "cuda")]
Cuda(#[from] CudaError),
#[error("Coaster implementation error: {0}")]
Implementation(String),
}