Skip to main content

generate_rust

Function generate_rust 

Source
pub fn generate_rust(
    schemas: &[JsonSchema],
    settings: &CodeGenSettings,
) -> CodeGenResult<GenerateRustOutput>
Expand description

Generate Rust source from one or more parsed schemas.

Callers must pass settings (use CodeGenSettings::builder and call [CodeGenSettingsBuilder::build] for all-default settings). Returns GenerateRustOutput with optional shared buffer and one buffer per schema. Root of each schema must have type: "object" and non-empty properties.

ยงErrors

Returns CodeGenError::RootNotObject if a root schema is not an object with properties. Returns CodeGenError::Io on write failure. Returns CodeGenError::Batch with index when one schema in the batch fails.