1#[derive(Debug, Clone)]
3pub enum Error {
4 TensorRt { message: String },
6 Cuda(async_cuda::Error),
8}
9
10impl std::fmt::Display for Error {
11 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
12 match self {
13 Error::TensorRt { message } => write!(f, "{message}"),
14 Error::Cuda(err) => write!(f, "{err}"),
15 }
16 }
17}
18
19impl std::error::Error for Error {}
20
21impl From<async_cuda::Error> for Error {
22 #[inline]
23 fn from(err: async_cuda::Error) -> Self {
24 Error::Cuda(err)
25 }
26}
27
28#[inline]
39pub(crate) fn last_error() -> Error {
40 Error::TensorRt {
41 message: crate::ffi::error::get_last_error_message(),
42 }
43}