1#[cfg(not(feature = "std"))]
4use alloc::string::String;
5use core::fmt;
6
7pub type InspectResult<T> = Result<T, InspectError>;
9
10#[derive(Debug, Clone, PartialEq, Eq)]
12pub enum InspectError {
13 LimitExceeded(String),
15
16 InvalidPath(String),
18
19 UnsupportedOperation(String),
21
22 CycleDetected,
24
25 Custom(String),
27}
28
29impl fmt::Display for InspectError {
30 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
31 match self {
32 InspectError::LimitExceeded(msg) => write!(f, "Limit exceeded: {}", msg),
33 InspectError::InvalidPath(msg) => write!(f, "Invalid path: {}", msg),
34 InspectError::UnsupportedOperation(msg) => {
35 write!(f, "Unsupported operation: {}", msg)
36 }
37 InspectError::CycleDetected => write!(f, "Cycle detected"),
38 InspectError::Custom(msg) => write!(f, "{}", msg),
39 }
40 }
41}
42
43#[cfg(feature = "std")]
44impl std::error::Error for InspectError {}