Macro biome_formatter::dbg_write
source · macro_rules! dbg_write { ($dst:expr, [$($arg:expr),+ $(,)?]) => { ... }; }
Expand description
Writes formatted data into the given buffer and prints all written elements for a quick and dirty debugging.
An example:
use biome_formatter::prelude::*;
use biome_formatter::{FormatState, VecBuffer};
let mut state = FormatState::new(SimpleFormatContext::default());
let mut buffer = VecBuffer::new(&mut state);
dbg_write!(buffer, [text("Hello")])?;
// ^-- prints: [src/main.rs:7][0] = StaticToken("Hello")
assert_eq!(buffer.into_vec(), vec![FormatElement::StaticText { text: "Hello" }]);
Note that the macro is intended as debugging tool and therefore you should avoid having
uses of it in version control for long periods (other than in tests and similar). Format output
from production code is better done with [write!]