1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use crateTierMetadata;
use JsonSchema;
use config_example_for;
use craterender_example_toml;
/// Renders the generated example configuration as commented TOML.
///
/// # Examples
///
/// ```
/// use schemars::JsonSchema;
/// use serde::{Deserialize, Serialize};
/// use tier::{ConfigMetadata, FieldMetadata, TierMetadata, config_example_toml};
///
/// #[derive(Debug, Serialize, Deserialize, JsonSchema)]
/// struct AppConfig {
/// port: u16,
/// }
///
/// impl TierMetadata for AppConfig {
/// fn metadata() -> ConfigMetadata {
/// ConfigMetadata::from_fields([
/// FieldMetadata::new("port")
/// .doc("Port used for incoming traffic")
/// .example("8080"),
/// ])
/// }
/// }
///
/// let example = config_example_toml::<AppConfig>();
/// assert!(example.contains("8080"));
/// assert!(example.contains("incoming traffic"));
/// ```