-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
Hello, is it possible to create format! macros analogue?
It is often i'm writing similar code like
use std::fmt::Write;
let mut buf = smallstr::SmallString::<[u8;64]>::new();
write!(&mut buf, "test_config_{}.conf", uuid).unwrap();But it can be rewritten using macros like
macro_rules! format_small {
($len:expr, $($arg:tt)*) => {
{
use std::fmt::Write;
let mut buf = smallstr::SmallString::<[u8; $len]>::new();
buf.write_fmt(::core::format_args!($($arg)*)).unwrap();
buf
}
};
}jcdyer
Metadata
Metadata
Assignees
Labels
No labels