std::write!
[−]
macro_rules! write { ( $ dst : expr , $ ( $ arg : tt ) * ) => { ... }; }
Use the format!
syntax to write data into a buffer.
This macro is typically used with a buffer of &mut
Write
.
See std::fmt
for more information on format syntax.
Examples
fn main() { 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"); }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");