1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
 * opencl stream executor
 * Copyright (C) 2021 trivernis
 * See LICENSE for more information
 */

use crossbeam_channel::RecvError;
use thiserror::Error;

pub type OCLStreamResult<T> = Result<T, OCLStreamError>;

#[derive(Error, Debug)]
pub enum OCLStreamError {
    #[error("OpenCL Error {0}")]
    OCLError(String),

    #[error("Stream Receive Error")]
    RecvError(#[from] RecvError),

    #[error("Stream Send Error")]
    SendError,
}

impl From<ocl::Error> for OCLStreamError {
    fn from(e: ocl::Error) -> Self {
        Self::OCLError(format!("{}", e))
    }
}