Describer
Helper crate that generates customizable Rust Structs describing strings.
Installation
[]
= "0.1"
Usage
Original syntax is inspired by GraphQL, reason why required fields end with
!.
Basic Structs:
Simple struct types will represent field_name: T as field_name: T!, while optional fields will represent optional_field_name: Option<T> as optional_field_name: T. Struct will be represented as StructName { field_name: T, .. }.
use Describe;
Unit Structs:
Unit struct will be represented just by the struct name, StructName:
use Describe;
;
Enum types:
Enum variants are represented in a traditional Set like representation inside a #{ <variants> }, so EnumName #{ VariantA, VariantB, .. }
use Describe;
Results and Vecs:
Results are explicitly represented, with Result<OK, ERROR>, while Vecs are represented, by default, inside [T]
use Describe;
Limitations:
- TupleStructs are not yet supported.
- Structured Enum Variants are not yet supported.
- Tuple Enum Variants are not yet supported.
- Non derivable types are not supported.