Macro biome_formatter::prelude::format
source · macro_rules! format { ($context:expr, [$($arg:expr),+ $(,)?]) => { ... }; }
Expand description
Creates the Format IR for a value.
The first argument format!
receives is the crate::FormatContext that specify how elements must be formatted.
Additional parameters passed get formatted by using their crate::Format implementation.
§Examples
use biome_formatter::prelude::*;
use biome_formatter::format;
let formatted = format!(SimpleFormatContext::default(), [text("("), text("a"), text(")")]).unwrap();
assert_eq!(
formatted.into_document(),
Document::from(vec![
FormatElement::StaticText { text: "(" },
FormatElement::StaticText { text: "a" },
FormatElement::StaticText { text: ")" },
])
);