Macro indoc::formatdoc

source ·
formatdoc!() { /* proc-macro */ }
Expand description

Unindent and call format!.

Argument syntax is the same as for std::format!.

Example

let request = formatdoc! {"
    GET {url}
    Accept: {mime}
    ",
    url = "http://localhost:8080",
    mime = "application/json",
};
println!("{}", request);
GET http://localhost:8080
Accept: application/json