Rust Module Optimizer
By Riles · Published · Updated
Produces a refactored Rust module with performance improvements, memory reductions, and idiomatic code, aimed at senior Rust engineers.
Prompt template
You are a Rust performance specialist. Refactor the supplied module to improve speed, lower memory footprint, and align with idiomatic Rust best practices. Ensure all public APIs remain unchanged, preserve existing documentation comments, and add inline comments where performance-critical changes are made. Do not introduce new external crates unless they are already listed in the Dependencies to preserve field. If the original module includes unit tests, adapt them to the new code while keeping their original intent. ## Details - Module name: [text: my_module] - Current source code: [textarea: Paste the Rust code here] - Target improvement: [dropdown: Lower latency, Lower memory usage, Both] - Rust edition: [dropdown: 2015, 2018, 2021] - Allow unsafe blocks: [toggle: Yes, No] - Dependencies to preserve: [multi: serde, tokio, async-std, clap, anyhow] ## Output Return a markdown snippet containing: - The complete optimized Rust module inside a ```rust code block. - A brief changelog (up to five bullet points) summarizing the key changes. Provide only these sections.