Macro interpolator::iwrite

source ·
macro_rules! iwrite {
    ($buf: expr, $fmt:expr, $($context:tt)*) => { ... };
}
Expand description

write() as a macro to allow specifying the context directly.

For details on the context syntax see context!.

use std::fmt::Write;
use interpolator::iwrite;

let mut buf = String::new();
iwrite!(&mut buf, "{a}, {b:?}", a = 10, b:? = "test").unwrap();

assert_eq!( buf, "10, \"test\"" );