Macro pretty::docs

source ·
macro_rules! docs {
    ($alloc: expr, $first: expr $(,)?) => { ... };
    ($alloc: expr, $first: expr $(, $rest: expr)+ $(,)?) => { ... };
}
Expand description

Concatenates a number of documents (or values that can be converted into a document via the Pretty trait, like &str)

use pretty::{docs, Arena, DocAllocator};
let arena = &Arena::<()>::new();
let doc = docs![
    arena,
    "let",
    arena.softline(),
    "x",
    arena.softline(),
    "=",
    arena.softline(),
    Some("123"),
];
assert_eq!(doc.1.pretty(80).to_string(), "let x = 123");