Expand description
Code to help generate functions.
The structure is:
Generator.impl_for():ImplFor.generate_fn():FnBuilder.body(|builder| { .. }):StreamBuilder
Afterwards, Generator::finish() must be called to take out the TokenStream produced.
Structs§
- Field
Builder - A builder for struct or enum variant fields.
- FnBuilder
- A builder for functions.
- GenConst
- A builder for constants.
- GenEnum
- Builder to generate an
enum <Name> { <value> { ... }, ... } - GenStruct
- Builder to generate a struct.
Defaults to a struct with named fields
struct <Name> { <field>: <ty>, ... } - Generate
Mod - Builder for generating a module with its contents.
- Generator
- The generator is used to generate code.
- Impl
- A helper struct for implementing functions for a given struct or enum.
- ImplFor
- A helper struct for implementing a trait for a given struct or enum.
- Path
- A path of identifiers, like
mod::Type. - Push
Parse Error - Failed to parse the code passed to
StreamBuilder::push_parsed - Stream
Builder - A helper struct build around a TokenStream to make it easier to build code.
Enums§
- FnSelf
Arg - The
selfargument of a function - String
OrIdent - Helper enum to differentiate between a
Identor aString.
Traits§
- Parent
- Helper trait to make it possible to nest several builders. Internal use only.