Skip to content

Instantly share code, notes, and snippets.

@heiwa4126
Last active September 29, 2020 08:46
Show Gist options
  • Save heiwa4126/afc751595eada0e090b21fa084425d43 to your computer and use it in GitHub Desktop.
Save heiwa4126/afc751595eada0e090b21fa084425d43 to your computer and use it in GitHub Desktop.
RustでCargo.tomlに書いた名前やバージョンを表示する方法
fn main() {
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
const PKGNAME: &'static str = env!("CARGO_PKG_NAME");
println!("{} v{}", PKGNAME, VERSION);
// println!("{} v{}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"));
// でもOK
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment