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
#[cfg_attr(feature = "rustc-serialization", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "serde-serialization", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ServerConfig {
pub host: String,
pub port: u16,
pub username: Option<String>,
pub password: Option<String>
}
impl Default for ServerConfig {
fn default() -> ServerConfig {
ServerConfig {
host: "127.0.0.1".to_owned(),
port: 38580,
username: None,
password: None
}
}
}
impl ServerConfig {
pub fn address(&self) -> String {
format!("{}:{}", self.host, self.port)
}
}