1#[derive(Debug)]
3pub enum Error {
4 Block,
6 Io,
8 Node,
10 Path,
12 Loop,
14}
15
16impl core::fmt::Display for Error {
17 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
18 core::fmt::Debug::fmt(self, f)
19 }
20}
21
22#[cfg(any(feature = "std", test))]
23impl std::error::Error for Error {}
24
25impl From<InvalidBlock> for Error {
26 fn from(_: InvalidBlock) -> Self {
27 Self::Block
28 }
29}
30
31impl From<IoError> for Error {
32 fn from(_: IoError) -> Self {
33 Self::Io
34 }
35}
36
37#[derive(Debug)]
39pub struct InvalidBlock;
40
41impl core::fmt::Display for InvalidBlock {
42 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
43 core::fmt::Debug::fmt(self, f)
44 }
45}
46
47#[cfg(any(feature = "std", test))]
48impl std::error::Error for InvalidBlock {}
49
50#[derive(Debug)]
52pub struct InvalidPath;
53
54impl core::fmt::Display for InvalidPath {
55 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
56 core::fmt::Debug::fmt(self, f)
57 }
58}
59
60#[cfg(any(feature = "std", test))]
61impl std::error::Error for InvalidPath {}
62
63#[derive(Debug)]
65pub struct IoError;
66
67impl core::fmt::Display for IoError {
68 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
69 core::fmt::Debug::fmt(self, f)
70 }
71}
72
73#[cfg(any(feature = "std", test))]
74impl std::error::Error for IoError {}