strunemix
Strunemix allows to build a struct with a form of its fields, by deriving enums of them.
Example
use *;
let person = Person ;
// Attributes names are turned to an enum
assert_eq!;
assert_eq!;
assert_eq!;
// Attributes data are turned to an enum
let pseudo_data = Pseudo;
let age_data = Age;
assert_eq!;
// Move between the struct and a form of it
let mut form = ;
form.set_data;
form.set_data;
let becky = from_form.unwrap;
assert_eq!;
If you want to build the attribute data from string values, you must implement the [StrunemixParsableData] trait to handle the conversion from the string data to the struct fields.
// Implement the trait for the enum names
// Build the attribute data from string values
let pseudo_expected = Pseudo;
let pseudo = from_str.unwrap.add_data.unwrap;
assert_eq!;
let mut form = ;
// Add the data to the form the way you want
// With the generated enums
form.set_data;
// or with the name as a string
form.set_data;
// or with a string for the data
form.set_data_str;
// or with only strings
form.set_data_str;
#
License: MIT