From 51a991314be1f9576e4d3f4ccf58a5e74b94c115 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Thu, 9 Jan 2025 19:16:36 +0400 Subject: [PATCH] feat: uformat macro wrapping ufmt::uwrite --- src/utils/mod.rs | 1 + src/utils/uformat.rs | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 src/utils/uformat.rs diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 069d6de..b7193a0 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -2,6 +2,7 @@ //! mod hifitime_serde; +pub mod uformat; use phf::phf_map; use serde::{Deserialize, Deserializer, Serialize, Serializer}; diff --git a/src/utils/uformat.rs b/src/utils/uformat.rs new file mode 100644 index 0000000..28b0e9f --- /dev/null +++ b/src/utils/uformat.rs @@ -0,0 +1,8 @@ +#[macro_export] +macro_rules! uformat { + ($($arg:tt)*) => {{ + let mut buf = String::new(); + ufmt::uwrite!(&mut buf, $($arg)*).unwrap(); + buf + }}; +}