Ok, i did it.
Bad news first:
I was not able to get it working with the rust-stuff from the repository.
I did not get to deep into this but it seems something is missing.
So first of all, you have to install rust with the script from their Homepage:
https://www.rust-lang.org/learn/get-started
I do not want to go too much into Details here. It is very straight forward.
Depending on your shell it is your part to get the PATH-stuff done.
I think for bash it is done automaticaly. With fish i had to do some extra work in my config.fish
As i have a raspberry 4 i use the 64bit-ubuntu-server (headless).
Therefor i need the 64bit ARM architecture to build my stuff:
rustup target add aarch64-unknown-linux-gnu
If you want to go the 32bit route i am pretty sure:
rustup target add armv7-unknown-linux-gnueabihf
gets the job done. But i have not tested it.
Now we need a Linker.
You might find other stuff but this one worked for me out of the box:
https://releases.linaro.org/components/toolchain/binaries/
gcc-linaro-5.5.0-2017.10-x86_64_aarch64-linux-gnu.tar.xz
There is newer stuff available. So there is room for experiments.
And if you are still on the 32bit road:
gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf.tar.xz
should be a good pointer into the right direction.
Again you have to decide where to put the thing and how to get it into the PATH.
This time even with bash you have something to do ;-)
Now we are pretty much done with picking up tools and actually can have some fun.
I am sure you can get away with giving rustc the target and the linker manually.
But because i am lazy i put this lines into my .cargo/config. Feel free to create it if it does not exist:
[build]
target = "aarch64-unknown-linux-gnu"
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
Again with 32bit stuff you have to adjust this lines accordingly.
And if you want to have even more fun with the Raspberry you can add:
[dependencies]
rust_gpiozero = "0.2.0"
to your Cargo.toml and let the pins on the raspberry do a little dance for you.