Answers for "how to do with cargo.toml"

1

rust get crate version

const VERSION: &'static str = env!("CARGO_PKG_VERSION");
const OPTION_VERSION: Option<&'static str> = option_env!("CARGO_PKG_VERSION");

// ...

println!("MyProgram v{}", VERSION);
println!("MyProgram v{}", OPTION_VERSION.unwrap_or("unknown"));
Posted by: Guest on October-02-2020

Code answers related to "how to do with cargo.toml"

Browse Popular Code Answers by Language