( typeName: string, schema: JSONSchema7, aliasType: string, ctx: RustCodegenCtx, description?: string, )
| 520 | } |
| 521 | |
| 522 | function emitRustTypeAlias( |
| 523 | typeName: string, |
| 524 | schema: JSONSchema7, |
| 525 | aliasType: string, |
| 526 | ctx: RustCodegenCtx, |
| 527 | description?: string, |
| 528 | ): void { |
| 529 | if (ctx.generatedNames.has(typeName)) return; |
| 530 | ctx.generatedNames.add(typeName); |
| 531 | |
| 532 | const lines: string[] = []; |
| 533 | pushRustDoc(lines, description || schema.description); |
| 534 | pushRustExperimentalDocs( |
| 535 | lines, |
| 536 | isSchemaExperimental(schema) || ctx.experimentalTypeNames.has(typeName), |
| 537 | ); |
| 538 | if (isSchemaDeprecated(schema)) { |
| 539 | lines.push(...rustDeprecatedAttributes()); |
| 540 | } |
| 541 | const aliasVis = isSchemaInternal(schema) ? "pub(crate)" : "pub"; |
| 542 | lines.push(`${aliasVis} type ${typeName} = ${aliasType};`); |
| 543 | ctx.typeAliases.push(lines.join("\n")); |
| 544 | } |
| 545 | |
| 546 | function emitRustArrayAlias( |
| 547 | typeName: string, |
no test coverage detected
searching dependent graphs…