This is a simple Docker environment for cross compiling Rust for the Raspberry Pi.
Build image:
docker build -t raspios-bullseye-rust-cross-compile .
Go to the root of your source code on your host system and execute:
docker run -v "$PWD:/home/local/src" -it raspios-bullseye-rust-cross-compile /bin/bash
This will mount the source directory in the ~/src
directory in the container.
In the container execute:
cd src
cargo build --release --target armv7-unknown-linux-gnueabihf