Easy Rust 182: Working with environmental variables

preview_player
Показать описание
After the args() function for args from the user, there is also the vars() function that gives you the vars for the environment: username, filename, everything to do with the current environment that the program is running in. It's also an iterator. From this chapter:

Рекомендации по теме
Комментарии
Автор

Please note that the env! macro will inspect the environment variables present at compile time while std::env::vars() will enumerate the environment variables at runtime. Those are two fundamentally different operations which are not interchangeable. This is also the reason for the build failing at 3:00

janh.