GenCo
GenCo is an even simpler code generator for Rust, specifically written for use in reproto.
It does not deal with language-specific syntax, instead it can do some of the basic necessities through specialization.
- Handle imports, if needed.
- Quote strings according to language convention.
- Indents and spaces your code according to simple rules.
Examples
Language Support
This section contains example code for some of the supported languages.
For more information, see docs.rs/genco.
Dart
Simple support for importing names.
extern crate genco;
Indentation Rules
The quote!
macro has the following rules for dealing with indentation and
spacing.
Two tokens that are separated, are spaced. Regardless of how many spaces there are between them.
So:
quote!;
Becomes:
More that two line breaks are collapsed.
So:
quote!
Becomes:
Indentation is determined on a row-by-row basis. If a column is further in than the one on the preceeding row, it is indented one level deeper.
Like wise if a column starts before the previous rows column, it is indended one level shallower.
So:
quote!
Becomes: