Supported Values
rust
pub enum Value {
Str, // String
Int, // i32
Long, // i64
Bool, // bool
}
Using with enum
rust
let store = ConfigLoader::new(&[("LONG_VAR", Value::Long)]).unwrap();
let num: i64 = store.get("LONG_VAR").unwrap();
Using with macro
rust
let env_values = convert_values! {
PORT: int, // typing is anything possible to lovercase to i32, str, string: Int,int,INT,Integer,I32,etc..
HOST: str, // same rule for str | string
CRITICAL_FLAG: bool, // same rule for bool | boolean
LONG_VAR: i64 // same rule for i64 | long
};
let store = ConfigLoader::new(&env_values).unwrap();
let port: i32 = store.get("PORT").unwrap();
let host: String = store.get("HOST").unwrap();
let flag: bool = store.get("CRITICAL_FLAG").unwrap();
let num: i64 = store.get("LONG_VAR").unwrap();