doc: add docs for module renaming
This commit is contained in:
parent
97e63b686d
commit
1ab465680f
1 changed files with 15 additions and 3 deletions
18
src/lib.rs
18
src/lib.rs
|
@ -75,7 +75,7 @@ impl From<EnvValue> for String {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Creates new public 'cfg' mod with function fo get each environment variable of mapping.
|
/// Creates new public mod with function fo get each environment variable of mapping.
|
||||||
///
|
///
|
||||||
/// All variables are required and program will panic if some variables haven't value, but you
|
/// All variables are required and program will panic if some variables haven't value, but you
|
||||||
/// can add default value for specific variable.
|
/// can add default value for specific variable.
|
||||||
|
@ -88,7 +88,6 @@ impl From<EnvValue> for String {
|
||||||
/// config! {
|
/// config! {
|
||||||
/// DATABASE_URL: String,
|
/// DATABASE_URL: String,
|
||||||
/// }
|
/// }
|
||||||
///
|
|
||||||
/// # fn main () {}
|
/// # fn main () {}
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
|
@ -100,10 +99,23 @@ impl From<EnvValue> for String {
|
||||||
/// DATABASE_URL: String,
|
/// DATABASE_URL: String,
|
||||||
/// HOST: String => "127.0.0.1".to_string(),
|
/// HOST: String => "127.0.0.1".to_string(),
|
||||||
/// }
|
/// }
|
||||||
///
|
|
||||||
/// # fn main () {}
|
/// # fn main () {}
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
|
/// By default itconfig lib creates module with 'cfg' name. But you can use simple meta instruction
|
||||||
|
/// if you want to rename module. In the example below we renamed module to 'configuration'
|
||||||
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// # #[macro_use] extern crate itconfig;
|
||||||
|
/// config! {
|
||||||
|
/// #![mod_name = configuration];
|
||||||
|
///
|
||||||
|
/// DEBUG: bool,
|
||||||
|
/// }
|
||||||
|
/// # fn main () {}
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
///
|
||||||
/// This module will also contain helper method:
|
/// This module will also contain helper method:
|
||||||
///
|
///
|
||||||
/// `init`
|
/// `init`
|
||||||
|
|
Reference in a new issue