fix: Properly handle alt-tags so they don't collide with default tags
This commit is contained in:
parent
04972416cb
commit
9ed47c0884
4 changed files with 357 additions and 211 deletions
|
|
@ -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),)*
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue