async_cuda_npp/
error.rs

1/// An error that occurred in NPP.
2#[derive(Debug, Clone)]
3pub enum Error {
4    /// Error code as reported by NPP.
5    ///
6    /// [NPP documentation](https://docs.nvidia.com/cuda/npp/group__typedefs__npp.html#ga1105a17b5e76381583c46ecd6a60fe21)
7    Npp(i32),
8    /// Error in CUDA backend.
9    ///
10    /// Refer to [`async_cuda_core::Error`].
11    Cuda(async_cuda_core::Error),
12}
13
14impl std::fmt::Display for Error {
15    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
16        match self {
17            Error::Cuda(err) => write!(f, "{err}"),
18            Error::Npp(error_code) => write!(f, "error code produced by NPP: {error_code}"),
19        }
20    }
21}
22
23impl std::error::Error for Error {}
24
25impl From<async_cuda_core::Error> for Error {
26    #[inline]
27    fn from(err: async_cuda_core::Error) -> Self {
28        Error::Cuda(err)
29    }
30}