Derive Macros

Implements std::str::FromStr for enum, which has same constraints as EnumToString and works in the opposite direction.

Implements unit_variant_iter() and all_variant_iter(), both of which return impl Iterator<Item = Self>. The unit version iters over unit variants, while the all version iters over both unit variants and expanded nested variants, effectively doing a DFS over the enum tree. The nested variant field type must also have all_variant_iter() defined. Currently no trait is defined to capture the two methods.

Implements std::string::ToString for enum, which must only contain unit variants or variants with single unnamed field, e.g. Some(T). Unit variants are converted to their snake case representations. Nested variants works similarly by joining the variant name and field representation with dot “.”. For example, None => “none”, and Some(None) => “some.none”.

Implements the Queriable trait for a model. An enum with variants that map to its fields are created with auto derive above: EnumToString, EnumFromStr and EnumIter. That enum is used as Queriable::FieldId. Subquery fields are accessed by delegating the subquery field_id to the corresponding sub-models.