Macro std::write []

macro_rules! write {
    ( $ dst : expr , $ ( $ arg : tt ) * ) => { ... };
}

Write formatted data into a buffer

This macro accepts a 'writer' (any value with a write_fmt method), a format string, and a list of arguments to format.

The write_fmt method usually comes from an implementation of std::fmt::Write or std::io::Write traits. The term 'writer' refers to an implementation of one of these two traits.

Passed arguments will be formatted according to the specified format string and the resulting string will be passed to the writer.

See std::fmt for more information on format syntax.

write! returns whatever the 'write_fmt' method returns.

Common return values include: fmt::Result, io::Result

Examples

use std::io::Write;

let mut w = Vec::new();
write!(&mut w, "test").unwrap();
write!(&mut w, "formatted {}", "arguments").unwrap();

assert_eq!(w, b"testformatted arguments");Run