Compilation environment

You can check environment variables at compile time by using the env!("VAR") and option_env!("VAR") macros. The first will retrieve the environment variable as &'static str. If the variable is not defined, the compilation will fail. The option_env!() macro avoids this by returning an Option::None if the environment variable is not set and an Option::Some(&'static str) if the variable is set:

const THE_KEY: &str = env!("KEY");
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.137.38