format!宏的替换方案,可以写入现有的缓冲区
作者:Alex Kladov
#10 in #drop-in
每月257次下载
6KB
是std::format!的替换方案,可选地接受一个现有的String缓冲区。
std::format!
String
use format_buf::format; let mut buf = format!("Roses are {},\n", "red"); let () = format!(buf, "Violets are {}.", "blue"); assert_eq!(buf, "\ Roses are red,\n\ Violets are blue.\ ")