lazy_settings/lib.rs
1/// This crate defines an attribute macro `#[settings(key = "xxx")]` to define settings to be
2/// initialized when they are used.
3///
4/// Example:
5///
6/// ```rust
7/// use lazy_settings::settings;
8///
9/// #[settings(key = "abcde")]
10/// struct AbcdeSettings {
11/// pub field_1: String,
12/// }
13/// ```
14///
15/// This will implement a `get(instance_name: &str)` method for `AbcdeSettings`, when `get(...)` is called, the settings
16/// will be returned if it's initialized before. Otherwise the
17/// fields are read from the environment variables in the following format. (Note that `abcde` is the key specified in the macro.)
18///
19/// `ALULU_APP_ABCDE_{instance_name.uppercase()}_{}` environment variables, where `{}` is the field names in upper case.
20pub use lazy_settings_macros::settings;
21pub use ::lazy_settings_macros;
22pub use ::parking_lot;
23pub use ::getset_scoped;
24pub use ::config;
25pub use ::serde;
26pub use ::once_cell;
27pub use ::eyre;
28
29#[cfg(test)]
30mod test {
31 #[test]
32 fn test_settings_macro() {
33 let t = trybuild::TestCases::new();
34 t.pass("tests/*.rs");
35 }
36}