Skip to main content

tesseract_ocr_static/
error.rs

1macro_rules! errors {
2    ($(($error: ident $description: literal))+) => {
3        $(
4            #[doc = $description]
5            #[derive(Debug)]
6            pub struct $error;
7
8            impl std::error::Error for $error {}
9
10            impl core::fmt::Display for $error {
11                fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
12                    f.write_str($description)
13                }
14            }
15        )+
16    };
17}
18
19errors! {
20    (InvalidImage "Invalid image")
21    (InvalidVariable "Invalid variable")
22    (RecognitionFailed "Recognition failed")
23    (InitFailed "Initialization failed")
24    (WriteFailed "Write failed")
25}