Files
confique/src/example.rs
Lukas Kalbertodt 651a06b252 Add typename attribute and refactor a bunch
This commit should have been two, I know. I feel bad about it.
2021-04-29 23:18:22 +02:00

43 lines
1.1 KiB
Rust

//! 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! {
//! An example configuration.
#![visibility = "pub"]
#![derive(Clone)]
#[derive(Clone, Copy)]
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,
},
#[typename = "Logger"]
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>,
},
}