import { EmitContext } from "@typespec/compiler"; import { EmitTarget, TypraEmitterOptions } from "../../lib.js"; import { BaseTestContext, TypeNode } from "../../ir/ast.js"; import { GeneratorOptions } from "../../emitter.js"; /** * Type mapping from TypeSpec scalar types to Rust types. * Retained for use by the test template context. */ export declare const rustTypeMapper: Record; /** * Stale generated files are removed centrally by `pruneStaleGeneratedFiles`, which uses the * previous run's manifest to decide ownership rather than guessing from file names. */ /** * Main entry point for Rust code generation. */ export declare const generateRust: (context: EmitContext, node: TypeNode, emitTarget: EmitTarget, options?: GeneratorOptions) => Promise; /** * Emit the root mod.rs file content (module declarations). * * @param rootModules - Module names emitted directly in the root (e.g. ["context"]) * @param groups - Group subfolder names (e.g. ["connection", "tools"]) */ export declare function emitRustLib(rootModules: string[], groups?: string[], disambiguations?: string[], declareOnlyModules?: string[]): string; /** * Emit a per-group mod.rs file that declares and re-exports all modules in that group. */ export declare function emitRustGroupMod(moduleNames: string[], childModuleNames?: string[], disambiguations?: string[], declareOnlyModules?: string[]): string; /** * Rust flattens grouped modules with glob re-exports (`pub use ::*`). When * two sibling modules that are both glob-re-exported expose a public item of the * same name — most commonly a same-named leaf submodule under different grouping * namespaces, e.g. `contracts/pipeline` and `operations/pipeline` — rustc raises * `ambiguous_glob_reexports` and the flattened path (`model::pipeline`) fails to * resolve with E0659 at every use site. Emit a deterministic explicit re-export * (`pub use ::;`) so the name binds unambiguously; the * lexicographically-first exposer wins, which is stable across runs and preserves * the pre-existing binding when a colliding leaf is newly introduced alongside it. */ export declare function disambiguateGlobReexports(children: Array<{ name: string; exposes: string[]; }>): string[]; export interface RustTestContext extends BaseTestContext { importPath: string; isPolymorphicBase: boolean; nativeSerialization?: "none" | "serde"; } /** * Emit an integration test file for a TypeSpec model type. */ export declare function emitRustTest(ctx: RustTestContext): string;