File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change 4
4
//!
5
5
//! ```rust,ignore # for some reason this crashes compiler
6
6
//! extern crate quire;
7
- //! #[macor_use ] extern crate serde_derive;
7
+ //! #[macro_use ] extern crate serde_derive;
8
8
//! use quire::{parse_config, Options};
9
9
//! use quire::validate::{Structure, Scalar};
10
10
//!
11
11
//! #[derive(Deserialize)]
12
+ //! #[allow(dead_code)]
12
13
//! struct Config {
13
14
//! item1: String,
14
15
//! item2: Option<String>,
15
16
//! }
16
17
//!
17
- //! fn validator<'static> () -> Structure<'static> {
18
+ //! fn validator() -> Structure<'static> {
18
19
//! Structure::new()
19
20
//! .member("item1", Scalar::new())
20
21
//! .member("item2", Scalar::new().optional())
21
22
//! }
22
23
//!
23
- //! let cfg: Config;
24
- //! cfg = parse_config("config.yaml", &validator(), &Options::default())
25
- //! .expect("valid config");
24
+ //! fn work(cfg: &Config) {
25
+ //! println!("item1 is {}.", cfg.item1);
26
+ //! //intln!("item2 is {}.", cfg.item2);
27
+ //! // hey, this is just demonstration code ...
28
+ //! }
26
29
//!
30
+ //! fn main() {
31
+ //! let cfg: Config;
32
+ //! cfg = parse_config("config.yaml", &validator(), &Options::default())
33
+ //! .expect("valid config");
34
+ //! work(&cfg)
35
+ //! }
27
36
//! ```
28
37
//!
29
38
#![ warn( missing_debug_implementations) ]
You can’t perform that action at this time.
0 commit comments