I have the following code for deserializing some YAML file with serde-yaml:
#[derive(Serialize, Deserialize, Clone)]
pub enum Solution {
// a solution which is an error where the error is supposed to happen
ErrorSolution {
solution_type: String,
error_name: String,
error_message: String
},
// a solution which is the value for a defined variable
VariableSolution {
solution_type: String,
variable_name: String,
variable_type: String,
variable_value: String
}
}
and am trying to implement the Display trait as follows:
... at least before running the program. Turns out I need to use &Solution::VariableSolution in the match, leave away the * before self and use ref before the fields to avoid moving borrowed content: