I am trying to parse an environment value; using std::env
as follows
let environment = env::var("SENSIBULL_ENVIRONMENT").unwrap();
This returns a string to the variable environment
. If I want to pass a default value, then I have to use the below code
let environment = env::var("SENSIBULL_ENVIRONMENT").unwrap_or("development".into());
but I was expecting to do it like
let environment = env::var("SENSIBULL_ENVIRONMENT").unwrap_or("development");
as mentioned in the Rust example
But then it shows error String expected but found &str
Why is that error not happening in the example code?