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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
use TokenStream;
use build_ui;
use ;
/// This attribute macro should be used when you create an entrypoint of a Rocal application.
///
/// ```rust
/// use rocal::config;
///
/// #[rocal::main]
/// fn app() {}
/// ```
///
/// This attribute macro should be used when you create an action of a controller.
///
/// ```rust
/// use crate::views::root_view::RootView;
/// use rocal::rocal_core::traits::{Controller, SharedRouter};
///
/// pub struct RootController {
/// router: SharedRouter,
/// view: RootView,
/// }
///
/// impl Controller for RootController {
/// type View = RootView;
/// fn new(router: SharedRouter, view: Self::View) -> Self {
/// RootController { router, view }
/// }
/// }
///
/// impl RootController {
/// #[rocal::action]
/// pub fn index(&self) {
/// self.view.index();
/// }
/// }
/// ```
///
/// This function-like macro sets up application routing.
///
/// ```rust
/// route! {
/// get "/" => { controller: RootController , action: index , view: RootView },
/// post "/users" => { controller: UsersController, action: create, view: UserView}
/// }
///
/// ```
/// This function-like macro makes `static CONFIG` which contains app_id, a connection of an embedded database, and sync server endpoint URL.
///
/// ```rust
/// config! {
/// app_id: "a917e367-3484-424d-9302-f09bdaf647ae" ,
/// sync_server_endpoint: "http://127.0.0.1:3000/presigned-url" ,
/// database_directory_name: "local" ,
/// database_file_name: "local.sqlite3"
/// }
/// ```
/// This function-like macro allows users to set a path where migration files are supposed to be.
///
/// ```rust
/// migrate!("db/migrations");
/// ```
/// This function-like macro generates code to produce HTML string.
///
/// ```rust
/// view! {
/// <div class="container">
/// <h1 class="title">{"Hello, World!"}</h1>
/// if true {
/// <p>{"This is how you can use this macro"}</p>
/// } else {
/// <p>{"Even you can use if-else condition control"}</p>
/// }
/// for item in items {
/// <p>{{ item.id }}{"Maybe, you also want to use for-loop."}</p>
/// }
/// </div>
/// }
/// ```