#[derive(Debug, Clone)]
pub enum Error {
TensorRt { message: String },
Cuda(async_cuda::Error),
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
Error::TensorRt { message } => write!(f, "{message}"),
Error::Cuda(err) => write!(f, "{err}"),
}
}
}
impl std::error::Error for Error {}
impl From<async_cuda::Error> for Error {
#[inline]
fn from(err: async_cuda::Error) -> Self {
Error::Cuda(err)
}
}
#[inline]
pub(crate) fn last_error() -> Error {
Error::TensorRt {
message: crate::ffi::error::get_last_error_message(),
}
}