Crate rusty_german_entity_macro[−][src]
Expand description
RustyEntity
Macro to facilitate the implementation of Exercise Structs. For the struct field is available the properties: description, expected_result, expected_results and sort.
Example
use rusty_german_entity_macro::RustyEntity; #[derive(RustyEntity)] struct PrepositionExercise { #[entity(description)] prepo: String, #[entity(expected_result)] case: String, }
This will generate a implementation as the following:
use rusty_german_types::Exercise; struct PrepositionExercise { prepo: String, case: String, } impl Exercise for PrepositionExercise { fn get_description(&self) -> String { self.prepo.to_owned() } fn get_expected_result(&self) -> String { self.case.to_owned() } }