Add example module for documentation

It currently doesn't show anything as all items are pub(crate).
This commit is contained in:
Lukas Kalbertodt
2021-04-29 19:00:36 +02:00
parent 1ae45a3e7c
commit bfab0e8798
5 changed files with 53 additions and 8 deletions

35
src/example.rs Normal file
View File

@@ -0,0 +1,35 @@
//! This module demonstrate what a `config!` invocation will generate. This
//! module exists merely for documentation purposes and is not usable from your
//! crate.
//!
//! TODO
use std::{net::IpAddr, path::PathBuf};
// This is necessary because the macro generates a bunch of paths starting with
// `confique`, assuming that symbol is in scope.
#[doc(hidden)]
use crate as confique;
crate::config! {
dns: {
/// The DNS server IP address.
#[example = "1.1.1.1"]
server: IpAddr,
/// Whether to use a local DNS resolution cache.
use_cache: bool = true,
/// How often to reattempt reaching the DNS server.
retry_attempts: u32 = 27,
},
log: {
/// Sets the log level. Possible values: "trace", "debug", "info",
/// "warn", "error" and "off".
level: log::LevelFilter = "info",
/// If this is set, log messages are also written to this file.
#[example = "/var/log/test.log"]
file: Option<PathBuf>,
},
}