Skip to main content

zql_cli/util/
text.rs

1#[macro_export]
2macro_rules! str_vec {
3    ($($x:literal),* $(,)?) => {
4        vec![$($x.to_string()),*]
5    };
6}
7
8#[macro_export]
9macro_rules! cow_arr {
10    ($($x:literal),* $(,)?) => {
11        &[$(Cow::Borrowed($x)),*]
12    };
13}
14
15#[macro_export]
16macro_rules! cow_str {
17    ($x:literal) => {
18        Cow::Borrowed($x)
19    };
20}
21
22pub fn join_strings(left: &str, right: &str) -> String {
23    let space = if left.is_empty() || right.is_empty() { "" } else { " " };
24    format!("{}{}{}", left, space, right)
25}