aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjan <jan@ruken.pw>2016-04-07 12:55:22 (UTC)
committerjan <jan@ruken.pw>2016-04-07 12:55:22 (UTC)
commit63e7f23364eef1eadeab49f3feab6480f77e1398 (patch)
tree4ea06436706f99f22d8109d5b0d2042de5d414f0
parent0720a83bcdc22684c68759755afb007579e0ebcc (diff)
bb, Cargo.lock. Tasterank jetzt immer brandaktuell.
-rw-r--r--.gitignore1
-rw-r--r--Cargo.lock442
-rw-r--r--Cargo.toml1
-rw-r--r--src/feature/tasterank.rs17
4 files changed, 14 insertions, 447 deletions
diff --git a/.gitignore b/.gitignore
index 80ddbfc..b480703 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
1target 1target
2data 2data
3Cargo.lock
diff --git a/Cargo.lock b/Cargo.lock
deleted file mode 100644
index e28540a..0000000
--- a/Cargo.lock
+++ /dev/null
@@ -1,442 +0,0 @@
1[root]
2name = "luggas"
3version = "0.1.0"
4dependencies = [
5 "telegram-bot 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
6]
7
8[[package]]
9name = "aho-corasick"
10version = "0.5.1"
11source = "registry+https://github.com/rust-lang/crates.io-index"
12dependencies = [
13 "memchr 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
14]
15
16[[package]]
17name = "bitflags"
18version = "0.4.0"
19source = "registry+https://github.com/rust-lang/crates.io-index"
20
21[[package]]
22name = "buf_redux"
23version = "0.1.3"
24source = "registry+https://github.com/rust-lang/crates.io-index"
25
26[[package]]
27name = "cookie"
28version = "0.2.2"
29source = "registry+https://github.com/rust-lang/crates.io-index"
30dependencies = [
31 "openssl 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
32 "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
33 "time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
34 "url 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)",
35]
36
37[[package]]
38name = "env_logger"
39version = "0.3.2"
40source = "registry+https://github.com/rust-lang/crates.io-index"
41dependencies = [
42 "log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
43 "regex 0.1.61 (registry+https://github.com/rust-lang/crates.io-index)",
44]
45
46[[package]]
47name = "gcc"
48version = "0.3.26"
49source = "registry+https://github.com/rust-lang/crates.io-index"
50
51[[package]]
52name = "gdi32-sys"
53version = "0.1.1"
54source = "registry+https://github.com/rust-lang/crates.io-index"
55dependencies = [
56 "winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
57]
58
59[[package]]
60name = "hpack"
61version = "0.2.0"
62source = "registry+https://github.com/rust-lang/crates.io-index"
63dependencies = [
64 "log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
65]
66
67[[package]]
68name = "httparse"
69version = "1.1.2"
70source = "registry+https://github.com/rust-lang/crates.io-index"
71
72[[package]]
73name = "hyper"
74version = "0.7.2"
75source = "registry+https://github.com/rust-lang/crates.io-index"
76dependencies = [
77 "cookie 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
78 "httparse 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
79 "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
80 "log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
81 "mime 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
82 "num_cpus 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
83 "openssl 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
84 "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
85 "solicit 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
86 "time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
87 "traitobject 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
88 "typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
89 "unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
90 "url 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)",
91]
92
93[[package]]
94name = "kernel32-sys"
95version = "0.2.1"
96source = "registry+https://github.com/rust-lang/crates.io-index"
97dependencies = [
98 "winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
99 "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
100]
101
102[[package]]
103name = "language-tags"
104version = "0.2.2"
105source = "registry+https://github.com/rust-lang/crates.io-index"
106
107[[package]]
108name = "lazy_static"
109version = "0.1.15"
110source = "registry+https://github.com/rust-lang/crates.io-index"
111
112[[package]]
113name = "libc"
114version = "0.2.9"
115source = "registry+https://github.com/rust-lang/crates.io-index"
116
117[[package]]
118name = "libressl-pnacl-sys"
119version = "2.1.6"
120source = "registry+https://github.com/rust-lang/crates.io-index"
121dependencies = [
122 "pnacl-build-helper 1.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
123]
124
125[[package]]
126name = "log"
127version = "0.3.5"
128source = "registry+https://github.com/rust-lang/crates.io-index"
129dependencies = [
130 "libc 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
131]
132
133[[package]]
134name = "matches"
135version = "0.1.2"
136source = "registry+https://github.com/rust-lang/crates.io-index"
137
138[[package]]
139name = "memchr"
140version = "0.1.10"
141source = "registry+https://github.com/rust-lang/crates.io-index"
142dependencies = [
143 "libc 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
144]
145
146[[package]]
147name = "mempool"
148version = "0.2.0"
149source = "registry+https://github.com/rust-lang/crates.io-index"
150
151[[package]]
152name = "mime"
153version = "0.1.3"
154source = "registry+https://github.com/rust-lang/crates.io-index"
155dependencies = [
156 "log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
157 "serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
158]
159
160[[package]]
161name = "mime_guess"
162version = "1.5.0"
163source = "registry+https://github.com/rust-lang/crates.io-index"
164dependencies = [
165 "mime 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
166 "phf 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
167 "phf_codegen 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
168]
169
170[[package]]
171name = "multipart"
172version = "0.5.1"
173source = "registry+https://github.com/rust-lang/crates.io-index"
174dependencies = [
175 "buf_redux 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
176 "env_logger 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
177 "hyper 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
178 "log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
179 "memchr 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
180 "mime 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
181 "mime_guess 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
182 "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
183 "tempdir 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
184]
185
186[[package]]
187name = "num"
188version = "0.1.31"
189source = "registry+https://github.com/rust-lang/crates.io-index"
190
191[[package]]
192name = "num_cpus"
193version = "0.2.11"
194source = "registry+https://github.com/rust-lang/crates.io-index"
195dependencies = [
196 "libc 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
197]
198
199[[package]]
200name = "openssl"
201version = "0.7.8"
202source = "registry+https://github.com/rust-lang/crates.io-index"
203dependencies = [
204 "bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
205 "gcc 0.3.26 (registry+https://github.com/rust-lang/crates.io-index)",
206 "lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
207 "libc 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
208 "openssl-sys 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
209 "openssl-sys-extras 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
210]
211
212[[package]]
213name = "openssl-sys"
214version = "0.7.8"
215source = "registry+https://github.com/rust-lang/crates.io-index"
216dependencies = [
217 "gdi32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
218 "libc 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
219 "libressl-pnacl-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
220 "pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
221 "user32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
222]
223
224[[package]]
225name = "openssl-sys-extras"
226version = "0.7.8"
227source = "registry+https://github.com/rust-lang/crates.io-index"
228dependencies = [
229 "gcc 0.3.26 (registry+https://github.com/rust-lang/crates.io-index)",
230 "libc 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
231 "openssl-sys 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
232]
233
234[[package]]
235name = "phf"
236version = "0.7.14"
237source = "registry+https://github.com/rust-lang/crates.io-index"
238dependencies = [
239 "phf_shared 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
240]
241
242[[package]]
243name = "phf_codegen"
244version = "0.7.14"
245source = "registry+https://github.com/rust-lang/crates.io-index"
246dependencies = [
247 "phf_generator 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
248 "phf_shared 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
249]
250
251[[package]]
252name = "phf_generator"
253version = "0.7.14"
254source = "registry+https://github.com/rust-lang/crates.io-index"
255dependencies = [
256 "phf_shared 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
257 "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
258]
259
260[[package]]
261name = "phf_shared"
262version = "0.7.14"
263source = "registry+https://github.com/rust-lang/crates.io-index"
264
265[[package]]
266name = "pkg-config"
267version = "0.3.8"
268source = "registry+https://github.com/rust-lang/crates.io-index"
269
270[[package]]
271name = "pnacl-build-helper"
272version = "1.4.10"
273source = "registry+https://github.com/rust-lang/crates.io-index"
274dependencies = [
275 "tempdir 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
276]
277
278[[package]]
279name = "rand"
280version = "0.3.14"
281source = "registry+https://github.com/rust-lang/crates.io-index"
282dependencies = [
283 "libc 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
284]
285
286[[package]]
287name = "regex"
288version = "0.1.61"
289source = "registry+https://github.com/rust-lang/crates.io-index"
290dependencies = [
291 "aho-corasick 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
292 "memchr 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
293 "mempool 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
294 "regex-syntax 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
295 "utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
296]
297
298[[package]]
299name = "regex-syntax"
300version = "0.3.1"
301source = "registry+https://github.com/rust-lang/crates.io-index"
302
303[[package]]
304name = "rustc-serialize"
305version = "0.3.18"
306source = "registry+https://github.com/rust-lang/crates.io-index"
307
308[[package]]
309name = "rustc_version"
310version = "0.1.7"
311source = "registry+https://github.com/rust-lang/crates.io-index"
312dependencies = [
313 "semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
314]
315
316[[package]]
317name = "semver"
318version = "0.1.20"
319source = "registry+https://github.com/rust-lang/crates.io-index"
320
321[[package]]
322name = "serde"
323version = "0.6.15"
324source = "registry+https://github.com/rust-lang/crates.io-index"
325dependencies = [
326 "num 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)",
327]
328
329[[package]]
330name = "solicit"
331version = "0.4.4"
332source = "registry+https://github.com/rust-lang/crates.io-index"
333dependencies = [
334 "hpack 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
335 "log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
336]
337
338[[package]]
339name = "telegram-bot"
340version = "0.4.2"
341source = "registry+https://github.com/rust-lang/crates.io-index"
342dependencies = [
343 "hyper 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
344 "multipart 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
345 "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
346 "url 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)",
347]
348
349[[package]]
350name = "tempdir"
351version = "0.3.4"
352source = "registry+https://github.com/rust-lang/crates.io-index"
353dependencies = [
354 "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
355]
356
357[[package]]
358name = "time"
359version = "0.1.34"
360source = "registry+https://github.com/rust-lang/crates.io-index"
361dependencies = [
362 "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
363 "libc 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
364 "winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
365]
366
367[[package]]
368name = "traitobject"
369version = "0.0.1"
370source = "registry+https://github.com/rust-lang/crates.io-index"
371
372[[package]]
373name = "typeable"
374version = "0.1.2"
375source = "registry+https://github.com/rust-lang/crates.io-index"
376
377[[package]]
378name = "unicase"
379version = "1.4.0"
380source = "registry+https://github.com/rust-lang/crates.io-index"
381dependencies = [
382 "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
383]
384
385[[package]]
386name = "unicode-bidi"
387version = "0.2.3"
388source = "registry+https://github.com/rust-lang/crates.io-index"
389dependencies = [
390 "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
391]
392
393[[package]]
394name = "unicode-normalization"
395version = "0.1.2"
396source = "registry+https://github.com/rust-lang/crates.io-index"
397
398[[package]]
399name = "url"
400version = "0.5.7"
401source = "registry+https://github.com/rust-lang/crates.io-index"
402dependencies = [
403 "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
404 "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
405 "unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
406 "unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
407 "uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
408]
409
410[[package]]
411name = "user32-sys"
412version = "0.1.2"
413source = "registry+https://github.com/rust-lang/crates.io-index"
414dependencies = [
415 "winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
416 "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
417]
418
419[[package]]
420name = "utf8-ranges"
421version = "0.1.3"
422source = "registry+https://github.com/rust-lang/crates.io-index"
423
424[[package]]
425name = "uuid"
426version = "0.1.18"
427source = "registry+https://github.com/rust-lang/crates.io-index"
428dependencies = [
429 "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
430 "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
431]
432
433[[package]]
434name = "winapi"
435version = "0.2.6"
436source = "registry+https://github.com/rust-lang/crates.io-index"
437
438[[package]]
439name = "winapi-build"
440version = "0.1.1"
441source = "registry+https://github.com/rust-lang/crates.io-index"
442
diff --git a/Cargo.toml b/Cargo.toml
index 4737ab2..8ce7c59 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -5,3 +5,4 @@ authors = ["jan <jan@ruken.pw>"]
5 5
6[dependencies] 6[dependencies]
7telegram-bot = "0.4" 7telegram-bot = "0.4"
8time = "0.1"
diff --git a/src/feature/tasterank.rs b/src/feature/tasterank.rs
index 13730e1..20146df 100644
--- a/src/feature/tasterank.rs
+++ b/src/feature/tasterank.rs
@@ -6,6 +6,7 @@ use std::ascii::AsciiExt;
6 6
7extern crate telegram_bot; 7extern crate telegram_bot;
8use telegram_bot::{Api, Message, MessageType}; 8use telegram_bot::{Api, Message, MessageType};
9extern crate time;
9 10
10use feature::FeatureResult; 11use feature::FeatureResult;
11use feature::Feature; 12use feature::Feature;
@@ -18,16 +19,20 @@ impl Feature for Tasterank {
18 fn name(&self) -> &'static str { 19 fn name(&self) -> &'static str {
19 "Tasterank" 20 "Tasterank"
20 } 21 }
21 fn init(&mut self) { 22 fn init(&mut self) {}
22 if let Err(e) = self.update_ranks() {
23 panic!(e);
24 }
25 }
26 fn handle(&mut self, a: Api, m: Message) -> Result<FeatureResult, String> { 23 fn handle(&mut self, a: Api, m: Message) -> Result<FeatureResult, String> {
27 if let MessageType::Text(s) = m.msg { 24 if let MessageType::Text(s) = m.msg {
28 if !(&s).to_ascii_lowercase().contains("luggas tasterank") { 25 if !(&s).to_ascii_lowercase().contains("luggas tasterank") {
29 return Ok(FeatureResult::Skip); 26 return Ok(FeatureResult::Skip);
30 } 27 }
28 let start = time::precise_time_ns();
29 if let Err(e) = self.update_ranks() {
30 println!("{}", e);
31 return Ok(FeatureResult::Skip);
32 }
33 println!("(benchm) updating ranks: {}ms",
34 (time::precise_time_ns() - start) / 1000000);
35
31 let mut msg = String::new(); 36 let mut msg = String::new();
32 for (i, rank) in self.ranks.iter().enumerate() { 37 for (i, rank) in self.ranks.iter().enumerate() {
33 msg.push_str(&format!("{}. {}\n", i + 1, rank)); 38 msg.push_str(&format!("{}. {}\n", i + 1, rank));
@@ -35,6 +40,8 @@ impl Feature for Tasterank {
35 if let Err(e) = a.send_message(m.chat.id(), msg, None, None, Some(m.message_id), None) { 40 if let Err(e) = a.send_message(m.chat.id(), msg, None, None, Some(m.message_id), None) {
36 println!("{}", e); 41 println!("{}", e);
37 } 42 }
43 println!("(benchm) tasterank: {}ms",
44 (time::precise_time_ns() - start) / 1000000);
38 return Ok(FeatureResult::Handled); 45 return Ok(FeatureResult::Handled);
39 } 46 }
40 Ok(FeatureResult::Skip) 47 Ok(FeatureResult::Skip)