Function doku::to_toml_fmt

source ·
pub fn to_toml_fmt<T>(fmt: &Formatting) -> Stringwhere
    T: Document,
Expand description

Generates a TOML documentation for specified type using custom formatting settings.

Example

use doku::Document;

#[derive(Document)]
struct Config {
    /// Database's host
    db_host: String,
}

let fmt = doku::toml::Formatting {
    layout: doku::toml::Layout::TwoColumns {
        align: true,
        spacing: 1,
    },
    ..Default::default()
};

let doc = doku::to_toml_fmt::<Config>(&fmt);

doku::assert_doc!(r#"
  db_host = "string" # Database's host
"#, doc);

For more details, please see: toml::Formatting.