EnvMan: Environments (variables) Manager
This crate adds a macro for easy management of environment variables.
If you would like to see more details, please see these codes.
Example
use EnvMan;
unsafe
// The type of field can be set if FromStr is implemented
// If rename is not set, it will be an upper case
let foo = load.unwrap;
// This value is taken from “F0”.
let f0 = foo.f0;
// This value is taken from “f1”.
let f_1 = foo.f_1;
// This value is taken from “F_N” and if it is not set, it will be set to “default value”.
let f_n = foo.f_n;
// This value is taken from “F_O” and if it is not set, it will be set to None.
let f_o = foo.f_o;
// This value is taken from “F_TEST” and if it is not set, it will be set to 1.
// and if it under test, it will be set to 2.
let f_test = foo.f_test;
Usecase
use ;
use EnvMan;
pub static ENVIRONMENTS: = new;
Field Attributes
- rename :
rename = "new name"(default: upper case) - parser:
parser = constants::default_parser(default: FromStr::from_str)parser type is
fn(&str) -> Result<T, E>andEhas implstd::error::Error - group_test: (default: None)
if under test, use this value (Priority is first)
- test:
testUse Default::default() - test:
test = Default::default()(put anything of expr)
- test:
- group_default: (default: None)
if not found in env, use this value if a test exists and is under test, use the test
- default:
default - default:
default = Default::default()(put anything of expr)
- default:
- alltime_parse:
alltime_parse(default: false)The normal default (and test) return value is the field type if this is set, the return value is a string and the parser is used
License
Licensed under