1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
    Appellation: scsys-macros <library>
    Contributors: FL03 <jo3mccain@icloud.com>
*/
//! # scsys-macros

pub(crate) mod utils;

#[macro_export]
macro_rules! shared {
    ( $arg:expr ) => {
        std::sync::Arc::new(std::sync::Mutex::new($arg))
    };
    ( $( $arg:expr ),* ) => {
        {
            let mut res = Vec::new();
            $(
                res.push(std::sync::Arc::new(std::sync::Mutex::new($arg)));
            )*
            res
        }
    };
}

#[macro_export]
macro_rules! create_method {
    ($vis:vis $name:ident, $arg:ident, $argty: ty) => {
        $vis fn $name($arg: $argty) {}
    };
}

#[macro_export]
macro_rules! string {
    ( $x:expr ) => {
        {
            $x.to_string()
        }
    };
    ( $( $x:expr ),* ) => {
        {
            let mut res = Vec::new();
            $(
                res.push($x.to_string());
            )*
            res
        }
    };
}

#[macro_export]
macro_rules! join {
    ( $( $x:expr ),* ) => {
        {
            let mut tmp = String::new();
            $(
                tmp.push_str($x);
            )*
            tmp
        }
    };
    ( $x:expr ) => {
        {
            let mut tmp = String::new();
            $(
                tmp.push_str($x);
            )*
            tmp
        }
    };
}

#[macro_export]
macro_rules! extend_path {
    ($(
        $x:expr;
        [ $( $y:expr ),* ]
    );*) => {
        vec![
            $($(
            format!("{}/{}", $x, $y)
            ),*),*
        ]
    }
}

#[cfg(feature = "gen")]
#[macro_export]
macro_rules! rstr {
    ( $( $x:expr ),* ) => {
        {
            let mut tmp = Vec::new();
            $(
                tmp.push($crate::utils::gen::gen_random_string($x));
            )*
            tmp
        }
    };
}