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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
use components::Parameter;
use std::borrow::Cow;
parameter!(AltRep, "ALTREP");
parameter!(CN, "CN");
parameter_with_const!(
CUType, "CUTYPE",
const INDIVIDUAL = "INDIVIDUAL";
const GROUP = "GROUP";
const RESOURCE = "RESOURCE";
const ROOM = "ROOM";
const UNKNOWN = "UNKNOWN"
);
parameter!(DelegatedFrom, "DELEGATED-FROM");
parameter!(DelegatedTo, "DELEGATED-TO");
parameter!(Dir, "DIR");
parameter!(FmtType, "FMTTYPE");
parameter_with_const!(
FBType, "FBTYPE",
const FREE = "FREE";
const BUSY = "BUSY";
const BUSY_UNAVAILABLE = "BUSY-UNAVAILABLE";
const BUSY_TENTATIVE = "BUSY-TENTATIVE"
);
parameter!(Language, "LANGUAGE");
parameter!(Member, "MEMBER");
parameter_with_const!(
PartStat, "PARTSTAT",
const NEEDS_ACTION = "NEEDS-ACTION";
const ACCEPTED = "ACCEPTED";
const DECLINED = "DECLINED";
const TENTATIVE = "TENTATIVE";
const DELEGATED = "DELEGATED";
const COMPLETED = "COMPLETED";
const IN_PROCESS = "IN-PROCESS"
);
parameter_with_const!(
RelType, "RELTYPE",
const PARENT = "PARENT";
const CHILD = "CHILD";
const SILBLING = "SILBLING"
);
parameter_with_const!(
Role, "ROLE",
const CHAIR = "CHAIR";
const REQ_PARTICIPANT = "REQ-PARTICIPANT";
const OPT_PARTICIPANT = "OPT-PARTICIPANT";
const NON_PARTICIPANT = "NON-PARTICIPANT"
);
parameter!(SentBy, "SENT-BY");
parameter!(TzIDParam, "TZID");
parameter_with_const!(
Value, "VALUE",
const BINARY = "BINARY";
const BOOLEAN = "BOOLEAN";
const CAL_ADDRESS = "CAL-ADDRESS";
const DATE = "DATE";
const DATE_TIME = "DATE-TIME";
const DURATION = "DURATION";
const FLOAT = "FLOAT";
const INTEGER = "INTEGER";
const PERIOD = "PERIOD";
const RECUR = "RECUR";
const TEXT = "TEXT";
const TIME = "TIME";
const URI = "URI";
const UTC_OFFSET = "UTC-OFFSET"
);
impl<'a> Default for CUType<'a> {
fn default() -> Self {
Self::INDIVIDUAL
}
}
impl<'a> Default for FBType<'a> {
fn default() -> Self {
Self::BUSY
}
}
impl<'a> Default for PartStat<'a> {
fn default() -> Self {
PartStat::NEEDS_ACTION
}
}
impl<'a> Default for RelType<'a> {
fn default() -> Self {
Self::PARENT
}
}
impl<'a> Default for Role<'a> {
fn default() -> Self {
Self::REQ_PARTICIPANT
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum Encoding {
Bit8,
Base64
}
impl Encoding {
fn into_value<'a>(self) -> Cow<'a, str> {
match self {
Encoding::Bit8 => Cow::Borrowed("8BIT"),
Encoding::Base64 => Cow::Borrowed("BASE64")
}
}
}
impl<'a> From<Encoding> for Parameter<'a> {
fn from(builder: Encoding) -> Self {
Parameter {
key: "ENCODING".into(),
value: builder.into_value()
}
}
}
impl Default for Encoding {
fn default() -> Self {
Encoding::Bit8
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum Range {
ThisAndFuture
}
impl Range {
fn into_value<'a>(self) -> Cow<'a, str> {
Cow::Borrowed("THISANDFUTURE")
}
}
impl<'a> From<Range> for Parameter<'a> {
fn from(builder: Range) -> Self {
Parameter {
key: "RANGE".into(),
value: builder.into_value()
}
}
}
impl Default for Range {
fn default() -> Self {
Range::ThisAndFuture
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum Related {
Start,
End
}
impl Related {
fn into_value<'a>(self) -> Cow<'a, str> {
match self {
Related::Start => Cow::Borrowed("START"),
Related::End => Cow::Borrowed("END")
}
}
}
impl<'a> From<Related> for Parameter<'a> {
fn from(builder: Related) -> Self {
Parameter {
key: "RELATED".into(),
value: builder.into_value()
}
}
}
impl Default for Related {
fn default() -> Self {
Related::Start
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum RSVP {
True,
False
}
impl RSVP {
fn into_value<'a>(self) -> Cow<'a, str> {
match self {
RSVP::True => Cow::Borrowed("TRUE"),
RSVP::False => Cow::Borrowed("FALSE")
}
}
}
impl<'a> From<RSVP> for Parameter<'a> {
fn from(builder: RSVP) -> Self {
Parameter {
key: "RSVP".into(),
value: builder.into_value()
}
}
}
impl Default for RSVP {
fn default() -> Self {
RSVP::False
}
}
#[cfg(feature = "rfc7986")]
pub use self::rfc7986::*;
#[cfg(feature = "rfc7986")]
mod rfc7986 {
use components::Parameter;
use std::borrow::Cow;
parameter_with_const!(
Display, "DISPLAY",
const BADGE = "BADGE";
const GRAPHIC = "GRAPHIC";
const FULLSIZE = "FULLSIZE";
const THUMBNAIL = "THUMBNAIL"
);
parameter!(Email, "EMAIL");
parameter_with_const!(
Feature, "FEATURE",
const AUDIO = "AUDIO";
const CHAT = "CHAT";
const FEED = "FEED";
const MODERATOR = "MODERATOR";
const PHONE = "PHONE";
const SCREEN = "SCREEN";
const VIDEO = "VIDEO"
);
parameter!(Label, "LABEL");
impl<'a> Default for Display<'a> {
fn default() -> Self {
Self::BADGE
}
}
}