From 0a95bae451c1847f4f0b9601e60959f4e8e6b669 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Thu, 12 Mar 2026 14:28:08 +0800 Subject: Refactor display utilities --- utils/src/macros.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 utils/src/macros.rs (limited to 'utils/src/macros.rs') diff --git a/utils/src/macros.rs b/utils/src/macros.rs new file mode 100644 index 0000000..f1cb75e --- /dev/null +++ b/utils/src/macros.rs @@ -0,0 +1,14 @@ +/// A macro for creating a `Vec` from string literals. +/// +/// # Examples +/// ``` +/// # use cli_utils::string_vec; +/// let v = string_vec!["hello", "world"]; +/// assert_eq!(v, vec!["hello".to_string(), "world".to_string()]); +/// ``` +#[macro_export] +macro_rules! string_vec { + ($($elem:expr),* $(,)?) => { + vec![$($elem.to_string()),*] + }; +} -- cgit