There's nothing special for applications written in Rust. Contrary to other solutions coming with a runtime, Rust builds normal applications relying on the standard env and practices. The normal rules of the system apply for configuration locations.
On linux you should first query the XDG paths then use $HOME
as fallback when it's not available.
Here's how you can do it:
use std::env::var;
fn main() {
let config_home = var("XDG_CONFIG_HOME")
.or_else(|_| var("HOME").map(|home|format!("{}/.config", home)));
println!("{:?}", config_home);
}
Note that several libraries do this job for you and take care of supporting alternate operating systems.
I won't link to them because they are many of them and they often change but your favourite search engine will direct you to the most popular ones if you search for "rust configuration directory".