parenchyma 0.0.33

A high-performance computing (HPC) framework
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use super::{ErrorKind, Result};
use super::super::foreign::CLStatus;

pub fn check<F, T>(cl_status: CLStatus, ok_value: F) -> Result<T> where F: FnOnce() -> T {
    
    match cl_status {
        CLStatus::CL_SUCCESS => Ok(ok_value()),

        e @ _ => {
            let kind: ErrorKind = e.into();
            let error = kind.into();
            Err(error)
        }
    }
}