rust格式化打印到文件

阅读量: searchstar 2021-07-05 09:58:41
Categories: Tags:

write!writeln!即可。

write!(&mut writer, "Factorial of {} = {}", num, factorial);

writeln!就是在最后自动加一个换行。

原文:https://stackoverflow.com/questions/32472495/how-do-i-write-a-formatted-string-to-a-file