std-function
fmt::write: send formatted arguments
Write a formatting plan into a text sink without needing an intermediate owned formatted string. Expected stdout (not executed): log:17 Common mistake: Ignoring the result when a custom destination may fail.
Formal Syntax & Structure
rust syntaxrust
std::fmt::write(&mut dyn fmt::Write, fmt::Arguments<'_>) -> fmt::ResultWorking Example
Example Snippetrust
fn main() { let mut buf=String::from("log:"); std::fmt::write(&mut buf, format_args!("{}", 17)).unwrap(); println!("{buf}");}