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
#[macro_export]
macro_rules! route {
(/, $first:expr $(, $routes: expr)*) => {
$first$(.or($routes))*
.boxed()
};
($path:expr, $first:expr $(, $routes: expr)*) => {
path!($path)
.and($first$(.or($routes))*)
.boxed()
};
}
#[macro_export]
macro_rules! get {
() => { warp::get2().and(warp::filters::path::end()) };
($($x:tt)*) => {
path!($($x)*).and(warp::filters::path::end())
};
}
#[macro_export]
macro_rules! post {
() => {
warp::post2()
.and(warp::filters::path::end())
.and(warp::body::json())
};
($($x:tt)*) => {
warp::post2()
.and(path!($($x)*))
.and(warp::filters::path::end())
.and(warp::body::json())
};
}
#[macro_export]
macro_rules! put {
() => {
warp::put2()
.and(warp::filters::path::end())
.and(warp::body::json())
};
($($x:tt)*) => {
warp::put2()
.and(path!($($x)*))
.and(warp::filters::path::end())
.and(warp::body::json())
};
}
#[macro_export]
macro_rules! del {
() => { warp::delete2().and(warp::filters::path::end()) };
($($x:tt)*) => {
warp::delete2()
.and(path!($($x)*))
.and(warp::filters::path::end())
};
}