Crate async_codegen

Crate async_codegen 

Source
Expand description

A library for async code generation that imposes no ownership choices (can use borrowed or owned data) and is fully composable using generics and general-purpose structs.

All syntax that can be generated is represented by a Writable. This is the core type of the library and it is quite simple. Any type that is supposed to be written to an output should implement this trait.

Writable output is sent to an Output. Output consists of the direct I/O output as well as some context tied to it.

Modules§

common
Provides common and re-usable types, including types that are conceptual to this library and its type model.
context
Using context for code generation requires importing this module
rust
Rust code syntax is available through this module.
util
Utilities to help with testing and other purposes

Macros§

static_context_provides
A macro that helps implement ContextProvides for simple struct fields.

Structs§

SimpleOutput
An output that simply composes an owned I/O stream with a dynamic context

Traits§

IoOutput
The raw IO output.
Output
Code generation output. This is a high-level trait intended to represent wherever you’re writing to, with associated context. It can be split into that context in order to separate the I/O stream itself.
SequenceAccept
A collector for multiple writable values. This trait is the ingredient to WritableSeq that represents how the sequence is handled. For example, accept can be implemented by adding commas after each element but not the last, which can be obtained using comma_separated:
Writable
A type that can be written to an output stream.
WritableSeq
A sequence of writable types. Sequences are modeled in the library by this interface, so that different separators can implement SequenceAccept.