[−][src]Macro dyn_fmt::dyn_write
Writes formatted data into a buffer. A runtime analog of write!
macro.
In contrast with the macro format string have not be a string literal.
This macro accepts three arguments: a writer, a format string, and an arguments iterator.
Arguments will be formatted according to the specified format string by calling Arguments::new(fmt, args)
,
and the result will be passed to the writer.
The writer may be any value with a write_fmt
method; generally this comes from an implementation of either
the fmt::Write
or the Write
trait.
The macro returns whatever the write_fmt
method returns;
commonly a fmt::Result
, or an io::Result
.
Examples:
use dyn_fmt::dyn_write; use std::fmt::Write; let mut buf = String::new(); dyn_write!(buf, "{}a{}b{}c", &[1, 2, 3]); assert_eq!(buf, "1a2b3c");