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
use self::super::read_toml_file;
use self::super::super::Error;
use toml::encode_str;
use std::path::Path;
use std::io::Write;
use std::fs::File;
#[derive(Debug, Clone, Hash, PartialEq, Eq, RustcEncodable, RustcDecodable)]
pub struct AppTokens {
pub github: String,
pub discord: String,
}
impl AppTokens {
pub fn read(p: &Path) -> Result<AppTokens, Error> {
read_toml_file(p, "App tokens")
}
pub fn write(&self, p: &Path) {
File::create(p).unwrap().write_all(encode_str(&self).as_bytes()).unwrap();
}
}