json-gen-c  0.1.5
json-gen-c generate C code for json manipulation
gencode_rust.c File Reference

Generate a Rust module (.rs) with native serde-compatible structs and enums from the parsed schema. The output is a single self-contained Rust file that uses serde + serde_json for JSON serialization. More...

#include "gencode/gencode.h"
#include "struct/struct_parse.h"
#include "utils/hash_map.h"
#include "utils/sstr.h"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
Include dependency graph for gencode_rust.c:

Classes

struct  enum_emit_ctx
 
struct  rust_gen_ctx
 
struct  dep_emit_struct_ctx
 

Functions

int gencode_rust (struct hash_map *struct_map, struct hash_map *enum_map, struct hash_map *oneof_map, sstr_t output)
 generate a Rust module (.rs) with native serde-compatible structs and enums.
 

Detailed Description

Generate a Rust module (.rs) with native serde-compatible structs and enums from the parsed schema. The output is a single self-contained Rust file that uses serde + serde_json for JSON serialization.

Function Documentation

◆ gencode_rust()

int gencode_rust ( struct hash_map struct_map,
struct hash_map enum_map,
struct hash_map oneof_map,
sstr_t  output 
)

generate a Rust module (.rs) with native serde-compatible structs and enums.

Parameters
struct_mapparsed struct definitions.
enum_mapparsed enum definitions.
oneof_mapparsed oneof (tagged union) definitions.
outputthe output Rust source content.
Returns
0 on success, -1 on failure.