Install the xtensa target with rustup, build your project with cargo, and flash it to the ESP32 using espflash.
Use the esp-idf-sys crate with cargo to build Rust applications for the ESP32, configuring the toolchain via rustup and the xtensa target.
rustup target add xtensa-esp32-none-elf
cargo install espflash
cargo build --target xtensa-esp32-none-elf --release
espflash flash --monitor /dev/ttyUSB0
This installs the ESP32 target, compiles your code, and flashes it to the device using the espflash utility.
You write your code in Rust, then use a special tool called cargo to translate it into a format the ESP32 chip understands. Once translated, you send that file directly to the chip over a USB cable to make it run. It is like writing a recipe in English, translating it to French for a French chef, and then handing the translated recipe to the chef to cook.