Add the Windows target with rustup and build your Rust project using the --target flag to generate a Windows executable from Linux.
Use rustup to install the Windows target and then compile your code with the --target flag pointing to x86_64-pc-windows-gnu or x86_64-pc-windows-msvc.
rustup target add x86_64-pc-windows-gnu
cargo build --target x86_64-pc-windows-gnu --release
This generates a Windows executable in target/x86_64-pc-windows-gnu/release/.
Cross-compiling means building a program on one operating system (Linux) to run on another (Windows). You tell the Rust toolchain to download the specific Windows tools it needs and then instruct it to generate a Windows file instead of a Linux one. It's like baking a cake in a French oven but packaging it for a customer in Japan.