pub trait Exercise {
// Required method
fn get_description(&self) -> String;
// Provided methods
fn get_expected_result(&self) -> String { ... }
fn get_expected_results(&self) -> Vec<String> { ... }
fn get_sort_property(&self) -> String { ... }
}Expand description
Generalization of an exercise that can have one single expected result or several.
Required Methods§
Sourcefn get_description(&self) -> String
fn get_description(&self) -> String
Returns the description of the exercise. This should help the user understand what should be done.
Provided Methods§
Sourcefn get_expected_result(&self) -> String
fn get_expected_result(&self) -> String
Returns a String that should test the input provided by the user.
Sourcefn get_expected_results(&self) -> Vec<String>
fn get_expected_results(&self) -> Vec<String>
Returns a Vector of Strings that one of it should test the input provided by the user.
Sourcefn get_sort_property(&self) -> String
fn get_sort_property(&self) -> String
Returns the property to sort the exercises. This is useful when you want to control the order in which the exercises appear. If this function is not implemented by a concrete Struct, the order of the exercises can be completely random.