Dup Ver Goto 📝

Rust Compile Time Macros 001

PT2/lang/rust/examples rust does not exist
To
15 lines, 55 words, 318 chars Page 'CompileTimeMacros_001' does not exist.

This takes the PATH variable, as it was when the binary was compiled. This does not fetch the PATH variable at runtime. This is why it can be a const fn.

use std;

const fn mac() -> &'static str {
    let path: &'static str = std::env!("PATH");
    path
}

fn main() {
    println!("{}",mac());
}