/* * opencl stream executor * Copyright (C) 2021 trivernis * See LICENSE for more information */ use crossbeam_channel::RecvError; use crossbeam_channel::SendError; use std::error::Error; use thiserror::Error; pub type OCLStreamResult = Result; #[derive(Error, Debug)] pub enum OCLStreamError { #[error("OpenCL Error {0}")] OCLError(String), #[error("Stream Receive Error")] RecvError(#[from] RecvError), #[error("Stream Send Error {0:?}")] SendError(#[from] Box), } impl From for OCLStreamError { fn from(e: ocl::Error) -> Self { Self::OCLError(format!("{}", e)) } } impl From> for OCLStreamError where T: Send + Sync, { fn from(e: SendError) -> Self { Self::SendError(Box::new(e)) } }