Skip to main content

merman_analysis/
status.rs

1#[repr(i32)]
2#[derive(Debug, Clone, Copy, PartialEq, Eq)]
3pub enum AnalysisStatus {
4    Ok = 0,
5    InvalidArgument = 1,
6    Utf8Error = 2,
7    OptionsJsonError = 3,
8    NoDiagram = 4,
9    ParseError = 5,
10    RenderError = 6,
11    UnsupportedFormat = 7,
12    Panic = 8,
13    InternalError = 9,
14    ResourceLimitExceeded = 10,
15}
16
17impl AnalysisStatus {
18    pub const fn code(self) -> i32 {
19        self as i32
20    }
21
22    pub const fn code_name(self) -> &'static str {
23        match self {
24            Self::Ok => "MERMAN_OK",
25            Self::InvalidArgument => "MERMAN_INVALID_ARGUMENT",
26            Self::Utf8Error => "MERMAN_UTF8_ERROR",
27            Self::OptionsJsonError => "MERMAN_OPTIONS_JSON_ERROR",
28            Self::NoDiagram => "MERMAN_NO_DIAGRAM",
29            Self::ParseError => "MERMAN_PARSE_ERROR",
30            Self::RenderError => "MERMAN_RENDER_ERROR",
31            Self::UnsupportedFormat => "MERMAN_UNSUPPORTED_FORMAT",
32            Self::Panic => "MERMAN_PANIC",
33            Self::InternalError => "MERMAN_INTERNAL_ERROR",
34            Self::ResourceLimitExceeded => "MERMAN_RESOURCE_LIMIT_EXCEEDED",
35        }
36    }
37}