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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
//! The arcon_macros crate contains macros used by arcon.
extern crate proc_macro;
extern crate syn;
extern crate quote;
use TokenStream;
/// Derive macro for declaring an ArconType
///
/// ## Usage
///
/// ```rust
/// use arcon::prelude::*;
///
/// #[arcon::proto]
/// #[derive(Arcon, Clone)]
/// pub struct ArconStruct {
/// pub id: u32,
/// pub timestamp: u64,
/// }
/// ```
/// A macro that helps set up and run an [Application](../arcon/application/struct.Application.html).
///
/// This macro is meant to simplify the creation of
/// arcon applications that do not require complex configuration. For more flexibility,
/// have a look at [ApplicationBulder](../arcon/application/builder/struct.ApplicationBuilder.html).
///
/// ## Usage
///
/// ### With no arguments
///
/// ```no_run
/// #[arcon::app]
/// fn main() {
/// (0..100u64)
/// .to_stream(|conf| conf.set_arcon_time(ArconTime::Process))
/// .map(|x| x * 10)
/// .print()
/// }
/// ```
///
/// Expands to the following
///
/// ```no_run
/// fn main() {
/// use arcon::prelude::*;
/// let mut builder = (0..100u64)
/// .to_stream(|conf| conf.set_arcon_time(ArconTime::Process))
/// .map(|x| x * 10)
/// .print()
/// .builder();
///
/// builder
/// .build()
/// .run_and_block();
/// }
/// ```
/// Derive macro for declaring an ArconState
///
/// ```rust
/// use arcon::prelude::*;
///
/// #[derive(ArconState)]
/// pub struct StreamingState<B: Backend> {
/// values: LazyValue<u64, B>,
/// }
/// ```
/// Derive macro for declaring an Arrow convertable type within the Arcon runtime
///
/// ```rust
/// use arcon::prelude::*;
///
/// #[derive(Arrow)]
/// pub struct ArrowStruct {
/// pub id: u32,
/// pub name: String,
/// }
/// ```
/// Implements [std::str::FromStr] for a struct using a delimiter
///
/// If no delimiter is specified, then `,` is chosen as default.
/// Note: All inner fields of the struct need to implement [std::str::FromStr] for the macro to work.
/// Helper macro to make a struct or enum prost-compatible without the need for annotations.
///
/// ```rust
/// use arcon::prelude::*;
///
/// #[arcon::proto]
/// struct Event {
/// s: String,
/// p: Point,
/// }
/// #[arcon::proto]
/// struct Point {
/// x: i32,
/// y: i32,
/// }
/// ```