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
use components::Parameter;
use std::borrow::Cow;
parameter_builder!(AltRep, "ALTREP");
parameter_builder!(CN, "CN");
parameter_builder!(CUType, "CUTYPE", "INDIVIDUAL");
parameter_builder!(DelegatedFrom, "DELEGATED-FROM");
parameter_builder!(DelegatedTo, "DELEGATED-TO");
parameter_builder!(Dir, "DIR");
parameter_builder!(FmtType, "FMTTYPE");
parameter_builder!(FBType, "FBTYPE", "BUSY");
parameter_builder!(Language, "LANGUAGE");
parameter_builder!(Member, "MEMBER");
parameter_builder!(PartStat, "PARTSTAT", "NEEDS-ACTION");
parameter_builder!(RelType, "RELTYPE", "PARENT");
parameter_builder!(Role, "ROLE", "REQ-PARTICIPANT");
parameter_builder!(SentBy, "SENT-BY");
parameter_builder!(TzIDParam, "TZID");
parameter_builder!(Value, "VALUE");
#[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_builder!(Display, "DISPLAY", "BADGE");
parameter_builder!(Email, "EMAIL");
parameter_builder!(Feature, "FEATURE");
parameter_builder!(Label, "LABEL");
}