problem_spec/
problem.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use std::error::Error;
use derive_builder::Builder;
use serde::Serialize;

#[derive(Debug)]
pub enum Severity {
    ADVICE,
    ERROR,
    WARNING,
}

#[derive(Builder, Default, Debug, Clone, Serialize)]
#[builder(default, try_setter, setter(into))]
pub struct ProblemGroup {
    pub name: &'static str,
    pub display_name: &'static str,
    pub parent: Option<Box<ProblemGroup>>,
}

impl Default for &ProblemGroup {
    fn default() -> Self {
        &ProblemGroup { name: "", display_name: "", parent: None }
    }
}

#[derive(Builder, Debug, Default, Clone, Serialize)]
#[builder(default, setter(into))]
pub struct ProblemSpec<'a> {
    id: &'a ProblemGroup,
    details: &'static str,
    solution: String,
    file_location: String,
    contextual_label: String,
    // err: Box<dyn Error>,
}