Rust system properties

How can I pass system properties to a rust program? In Java for instance I could use the -D flag when I start the process i.e. java -Dmyprop="Value" . Is there an equivalent for rust?

Thanks in advance.

What do you mean by "system properties"? There's no common parameters for "Rust runtime", like there's for Java (since the runtime is basically non-existant) [1]. Programs mostly get their parameters either as command line arguments, as configuration files, or from the environment, and neither of these ways are Rust-specific.


  1. aside from some environment variables like RUST_BACKTRACE, used by standard library ↩ī¸Ž

6 Likes

There is no such thing in Rust. The closest you can do is set environmental variables and read them in Rust with std::env::var.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.