Macro clap::load_yaml [−][src]
macro_rules! load_yaml {
($yml : expr) => { ... };
}
Expand description
A convenience macro for loading the YAML file at compile time (relative to the current file, like modules work). That YAML object can then be passed to this function.
Panics
The YAML file must be properly formatted or this function will panic!(). A good way to
ensure this doesn’t happen is to run your program with the --help
switch. If this passes
without error, you needn’t worry because the YAML is properly formatted.
Examples
The following example shows how to load a properly formatted YAML file to build an instance
of an App
struct.
ⓘ
let yml = load_yaml!("app.yml");
let app = App::from_yaml(yml);
// continued logic goes here, such as `app.get_matches()` etc.