Macro biome_formatter::prelude::format_args
source · macro_rules! format_args { ($($value:expr),+ $(,)?) => { ... }; }
Expand description
Constructs the parameters for other formatting macros.
This macro functions by taking a list of objects implementing crate::Format. It canonicalize the arguments into a single type.
This macro produces a value of type crate::Arguments. This value can be passed to
the macros within crate. All other formatting macros (format!
,
write!
) are proxied through this one. This macro avoids heap allocations.
You can use the Arguments
value that format_args!
returns in Format
contexts
as seen below.
use biome_formatter::{SimpleFormatContext, format, format_args};
use biome_formatter::prelude::*;
let formatted = format!(SimpleFormatContext::default(), [
format_args!(text("Hello World"))
])?;
assert_eq!("Hello World", formatted.print()?.as_code());