fix: Properly handle alt-tags so they don't collide with default tags

This commit is contained in:
Gerald Pinder 2024-08-24 20:05:49 -04:00
parent 04972416cb
commit 9ed47c0884
4 changed files with 357 additions and 211 deletions

View file

@ -136,6 +136,7 @@ macro_rules! cmd {
};
}
/// Easily create a `String`.
#[macro_export]
macro_rules! string {
($str:expr) => {
@ -143,14 +144,36 @@ macro_rules! string {
};
}
/// Easily create a `Cow<'_, str>`.
#[macro_export]
macro_rules! cowstr {
($str:expr) => {
::std::borrow::Cow::<'_, str>::from($str)
};
}
/// Easily create a `Vec<String>`.
/// Uses the same syntax as `vec![]`.
#[macro_export]
macro_rules! string_vec {
($($string:expr),+ $(,)?) => {
($($string:expr),* $(,)?) => {
{
use $crate::string;
vec![
$($crate::string!($string),)*
]
}
};
}
/// Easily create a `Vec<Cow<'_, str>>`.
/// Uses the same syntax as `vec![]`.
#[macro_export]
macro_rules! cowstr_vec {
($($string:expr),* $(,)?) => {
{
vec![
$($crate::cowstr!($string),)*
]
}
};
}