#[cfg(not(feature = "std"))]
use alloc::string::String;
use core::fmt;
#[derive(Debug, Clone)]
pub enum CpuKernelError {
InvalidKernel(String),
InvalidInput(String),
NullPointer(String),
Message(String),
}
impl fmt::Display for CpuKernelError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
CpuKernelError::InvalidKernel(msg) => write!(f, "invalid kernel: {}", msg),
CpuKernelError::InvalidInput(msg) => write!(f, "invalid input: {}", msg),
CpuKernelError::NullPointer(msg) => write!(f, "null pointer: {}", msg),
CpuKernelError::Message(msg) => write!(f, "message: {}", msg),
}
}
}
#[cfg(feature = "std")]
impl std::error::Error for CpuKernelError {}
pub type Result<T> = core::result::Result<T, CpuKernelError>;