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
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq)]
pub struct IceServer {
pub uris: std::option::Option<std::vec::Vec<std::string::String>>,
pub username: std::option::Option<std::string::String>,
pub password: std::option::Option<std::string::String>,
pub ttl: i32,
}
impl IceServer {
pub fn uris(&self) -> std::option::Option<&[std::string::String]> {
self.uris.as_deref()
}
pub fn username(&self) -> std::option::Option<&str> {
self.username.as_deref()
}
pub fn password(&self) -> std::option::Option<&str> {
self.password.as_deref()
}
pub fn ttl(&self) -> i32 {
self.ttl
}
}
impl std::fmt::Debug for IceServer {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("IceServer");
formatter.field("uris", &self.uris);
formatter.field("username", &self.username);
formatter.field("password", &self.password);
formatter.field("ttl", &self.ttl);
formatter.finish()
}
}
pub mod ice_server {
#[non_exhaustive]
#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct Builder {
pub(crate) uris: std::option::Option<std::vec::Vec<std::string::String>>,
pub(crate) username: std::option::Option<std::string::String>,
pub(crate) password: std::option::Option<std::string::String>,
pub(crate) ttl: std::option::Option<i32>,
}
impl Builder {
pub fn uris(mut self, input: impl Into<std::string::String>) -> Self {
let mut v = self.uris.unwrap_or_default();
v.push(input.into());
self.uris = Some(v);
self
}
pub fn set_uris(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.uris = input;
self
}
pub fn username(mut self, input: impl Into<std::string::String>) -> Self {
self.username = Some(input.into());
self
}
pub fn set_username(mut self, input: std::option::Option<std::string::String>) -> Self {
self.username = input;
self
}
pub fn password(mut self, input: impl Into<std::string::String>) -> Self {
self.password = Some(input.into());
self
}
pub fn set_password(mut self, input: std::option::Option<std::string::String>) -> Self {
self.password = input;
self
}
pub fn ttl(mut self, input: i32) -> Self {
self.ttl = Some(input);
self
}
pub fn set_ttl(mut self, input: std::option::Option<i32>) -> Self {
self.ttl = input;
self
}
pub fn build(self) -> crate::model::IceServer {
crate::model::IceServer {
uris: self.uris,
username: self.username,
password: self.password,
ttl: self.ttl.unwrap_or_default(),
}
}
}
}
impl IceServer {
pub fn builder() -> crate::model::ice_server::Builder {
crate::model::ice_server::Builder::default()
}
}
#[allow(missing_docs)]
#[non_exhaustive]
#[derive(
std::clone::Clone,
std::cmp::Eq,
std::cmp::Ord,
std::cmp::PartialEq,
std::cmp::PartialOrd,
std::fmt::Debug,
std::hash::Hash,
)]
pub enum Service {
#[allow(missing_docs)]
Turn,
Unknown(String),
}
impl std::convert::From<&str> for Service {
fn from(s: &str) -> Self {
match s {
"TURN" => Service::Turn,
other => Service::Unknown(other.to_owned()),
}
}
}
impl std::str::FromStr for Service {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
Ok(Service::from(s))
}
}
impl Service {
pub fn as_str(&self) -> &str {
match self {
Service::Turn => "TURN",
Service::Unknown(s) => s.as_ref(),
}
}
pub fn values() -> &'static [&'static str] {
&["TURN"]
}
}
impl AsRef<str> for Service {
fn as_ref(&self) -> &str {
self.as_str()
}
}