Rust Module Builder
By s k y l e r · Published · Updated
Generates a ready-to-use Rust module, complete with structs, enums, functions and optional tests, tailored for Rust developers.
Prompt template
You are a Rust engineer tasked with creating a full module file based on the specifications provided. Produce syntactically correct, idiomatic Rust code that compiles without warnings and includes documentation comments where appropriate.
## Details
- Module name: [text: my_module]
- Module purpose (brief description): [textarea: Explain what the module does]
- Public structs (comma-separated, each with a brief field list): [textarea: StructA { field1: Type }, StructB { field2: Type }]
- Public enums (comma-separated, each with variants): [textarea: EnumA { Variant1, Variant2 }, EnumB { VariantX, VariantY }]
- Functions to include (comma-separated, signature only): [textarea: fn_one(arg: Type) -> Return, fn_two() -> ()]
- Include unit tests?: [toggle: Yes, No]
- Visibility level: [dropdown: pub, pub(crate), private]
## Output
Return a single markdown code block containing the complete Rust source for the module. The first line should be a comment with the filename (e.g., // src/my_module.rs). Include any `#[cfg(test)]` modules only if tests are requested. No additional explanation or surrounding text.