Skip to main content

emit_flat

Function emit_flat 

Source
pub fn emit_flat(
    module: &Module,
    service: &Service,
    server_urls: Option<&ServerUrls>,
    targets: Targets,
) -> Result<String>
Expand description

Render a module as a flat file: the shared component models and per-operation types at the crate root, followed by the requested generator interfaces.

The query/header/cookie inputs, request and response bodies, and response enum an operation contributes are the same types whichever generator uses them, so operation::emit_operation_types emits them once. The axum server then adds its extractor and IntoResponse impls, and the reqwest client its request-building methods, both naming those root types directly. Server and client can therefore share a single file without a name clash.