More specifically, it will automatically implement `TryFrom<HashMap<OsString,
OsString>>`. This is primarily useful for testing.
# Using on a `struct`
To use this derive macro on a `struct`, it must have named fields (i.e.
it cannot be a unit `struct` or tuple `struct`) and each field's type must
implement the [`Parser`](parser::Parser) trait.
Field names are converted to `SCREAMING_SNAKE_CASE` before being used as a
key to access values in the environment variables or [`HashMap`] when calling
the generated [`TryFromEnv::try_from_env`] function or [`TryFrom::try_from`]
function, respectively. The values associated with those keys will then be
[`Parser::parse`]d into their corresponding fields. Key-value pairs in the
environment variables or [`HashMap`] that don't have a corresponding field are
ignored.
[`HashMap`]: std::collections::HashMap
[`Parser::parse`]: crate::parser::Parser::parse
# Grammars
There are some grammars below; they're written in [EBNF]. Whitespace isn't
*explicitly* included in these for readability, but it *is* allowed between
every concatenation.
[EBNF]: https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form
# Attributes
This derive macro recognizes attributes described by the `attributes`
nonterminal in the grammar below.
```ebnf
key = ? IDENTIFIER_OR_KEYWORD ? ;
(* https://doc.rust-lang.org/reference/identifiers.html *)
value = ? TokenTree ? ;
(* https://doc.rust-lang.org/reference/macros.html *)
eq style = key, "=", value ;
paren style = key, "(", value, ")" ;
key value pairs = either style, { ",", either style }, [ "," ] ;
attribute = "#", "[", "wrath", "(", key value pairs, ")", "]" ;
attributes = { attribute } ;
```
Each `key` cannot be specified more than once for a single item (e.g. a `struct`
definition or field definition).
Further sections describe the possible `key`s and the grammar of their
associated `value`s, which can be substituted in for the `value` nonterminal in
the grammar above.
## Container attribute keys
This section describes the attribute keys that can be applied to containers.
Containers are the syntax structures that define things like `struct`s.
### `error`
This key gives this macro information about the error type it needs to generate.
The generated error type will be an `enum` with one variant per field; the name
of the latter is converted to `PascalCase` and used as the former.
**Required:** yes
**Grammar:**
```ebnf
attribute = ? OuterAttribute ? ;
(* https://doc.rust-lang.org/stable/reference/attributes.html *)
visibility = ? Visibility ? ;
(* https://doc.rust-lang.org/stable/reference/visibility-and-privacy.html *)
ident = ? IDENTIFIER ? ;
(* https://doc.rust-lang.org/reference/identifiers.html *)
value = { attribute }, [ visibility ], ident ;
```
Note that doc comments desugar to attributes.
### `crate`
This key allows overriding the path the derive macro uses to reference items in
the `wrath` crate. This is useful, for example, if the `wrath` crate has been
renamed in `Cargo.toml` or is being re-exported from another crate.
**Required:** no
**Grammar:**
```ebnf
simple path = ? SimplePath ? ;
(* https://doc.rust-lang.org/stable/reference/paths.html *)
value = simple path ;
```