ares/checkers/
checker_result.rs

1use super::checker_type::Checker;
2
3/// The checkerResult struct is used to store the results of a checker.
4pub struct CheckResult {
5    /// If our checkers return success, we change this bool to True
6    pub is_identified: bool,
7    /// text is the text before we check it.
8    // we can make this &'text str
9    // but then crack requires lifetime annotations.
10    pub text: String,
11    /// Description of the checked text.
12    pub description: String,
13    /// Name of the Checker we are using
14    pub checker_name: &'static str,
15    /// Description of the Checker we are using
16    pub checker_description: &'static str,
17    /// Link to more info about checker
18    pub link: &'static str,
19}
20
21/// To save time we have a default
22/// for checkResult in case we fail
23/// I do not believe the checker is important if failed
24/// as we will not use it. To save time we will return a default
25/// checker.
26impl CheckResult {
27    /// Creates a default CheckResult
28    pub fn new<Type>(checker_used: &Checker<Type>) -> CheckResult {
29        CheckResult {
30            is_identified: false,
31            text: "".to_string(),
32            checker_name: checker_used.name,
33            checker_description: checker_used.description,
34            description: "".to_string(),
35            link: checker_used.link,
36        }
37    }
38}