~repos /rust-embed

#rust#proc-macro#http

git clone https://pyrossh.dev/repos/rust-embed.git

rust macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev.


44533ec6 pyros2097

7 years ago
add rocket example
Files changed (5) hide show
  1. Cargo.lock +544 -0
  2. Cargo.toml +5 -0
  3. examples/public/index.html +3 -3
  4. examples/rocket.rs +46 -0
  5. readme.md +1 -1
Cargo.lock CHANGED
@@ -1,8 +1,187 @@
1
+ [[package]]
2
+ name = "arrayvec"
3
+ version = "0.4.7"
4
+ source = "registry+https://github.com/rust-lang/crates.io-index"
5
+ dependencies = [
6
+ "nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
7
+ ]
8
+
9
+ [[package]]
10
+ name = "base64"
11
+ version = "0.6.0"
12
+ source = "registry+https://github.com/rust-lang/crates.io-index"
13
+ dependencies = [
14
+ "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
15
+ "safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
16
+ ]
17
+
18
+ [[package]]
19
+ name = "bitflags"
20
+ version = "1.0.1"
21
+ source = "registry+https://github.com/rust-lang/crates.io-index"
22
+
23
+ [[package]]
24
+ name = "byteorder"
25
+ version = "1.2.1"
26
+ source = "registry+https://github.com/rust-lang/crates.io-index"
27
+
1
28
  [[package]]
2
29
  name = "cfg-if"
3
30
  version = "0.1.2"
4
31
  source = "registry+https://github.com/rust-lang/crates.io-index"
5
32
 
33
+ [[package]]
34
+ name = "cookie"
35
+ version = "0.9.2"
36
+ source = "registry+https://github.com/rust-lang/crates.io-index"
37
+ dependencies = [
38
+ "base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
39
+ "ring 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
40
+ "time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)",
41
+ "url 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
42
+ ]
43
+
44
+ [[package]]
45
+ name = "crossbeam-deque"
46
+ version = "0.2.0"
47
+ source = "registry+https://github.com/rust-lang/crates.io-index"
48
+ dependencies = [
49
+ "crossbeam-epoch 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
50
+ "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
51
+ ]
52
+
53
+ [[package]]
54
+ name = "crossbeam-epoch"
55
+ version = "0.3.0"
56
+ source = "registry+https://github.com/rust-lang/crates.io-index"
57
+ dependencies = [
58
+ "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
59
+ "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
60
+ "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
61
+ "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
62
+ "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
63
+ "nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
64
+ "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
65
+ ]
66
+
67
+ [[package]]
68
+ name = "crossbeam-utils"
69
+ version = "0.2.2"
70
+ source = "registry+https://github.com/rust-lang/crates.io-index"
71
+ dependencies = [
72
+ "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
73
+ ]
74
+
75
+ [[package]]
76
+ name = "dtoa"
77
+ version = "0.4.2"
78
+ source = "registry+https://github.com/rust-lang/crates.io-index"
79
+
80
+ [[package]]
81
+ name = "fuchsia-zircon"
82
+ version = "0.3.3"
83
+ source = "registry+https://github.com/rust-lang/crates.io-index"
84
+ dependencies = [
85
+ "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
86
+ "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
87
+ ]
88
+
89
+ [[package]]
90
+ name = "fuchsia-zircon-sys"
91
+ version = "0.3.3"
92
+ source = "registry+https://github.com/rust-lang/crates.io-index"
93
+
94
+ [[package]]
95
+ name = "gcc"
96
+ version = "0.3.54"
97
+ source = "registry+https://github.com/rust-lang/crates.io-index"
98
+
99
+ [[package]]
100
+ name = "httparse"
101
+ version = "1.2.4"
102
+ source = "registry+https://github.com/rust-lang/crates.io-index"
103
+
104
+ [[package]]
105
+ name = "hyper"
106
+ version = "0.10.13"
107
+ source = "registry+https://github.com/rust-lang/crates.io-index"
108
+ dependencies = [
109
+ "base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
110
+ "httparse 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
111
+ "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
112
+ "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
113
+ "mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
114
+ "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
115
+ "time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)",
116
+ "traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
117
+ "typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
118
+ "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
119
+ "url 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
120
+ ]
121
+
122
+ [[package]]
123
+ name = "idna"
124
+ version = "0.1.4"
125
+ source = "registry+https://github.com/rust-lang/crates.io-index"
126
+ dependencies = [
127
+ "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
128
+ "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
129
+ "unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
130
+ ]
131
+
132
+ [[package]]
133
+ name = "isatty"
134
+ version = "0.1.6"
135
+ source = "registry+https://github.com/rust-lang/crates.io-index"
136
+ dependencies = [
137
+ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
138
+ "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
139
+ "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
140
+ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
141
+ ]
142
+
143
+ [[package]]
144
+ name = "itoa"
145
+ version = "0.3.4"
146
+ source = "registry+https://github.com/rust-lang/crates.io-index"
147
+
148
+ [[package]]
149
+ name = "kernel32-sys"
150
+ version = "0.2.2"
151
+ source = "registry+https://github.com/rust-lang/crates.io-index"
152
+ dependencies = [
153
+ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
154
+ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
155
+ ]
156
+
157
+ [[package]]
158
+ name = "language-tags"
159
+ version = "0.2.2"
160
+ source = "registry+https://github.com/rust-lang/crates.io-index"
161
+
162
+ [[package]]
163
+ name = "lazy_static"
164
+ version = "0.2.11"
165
+ source = "registry+https://github.com/rust-lang/crates.io-index"
166
+
167
+ [[package]]
168
+ name = "lazy_static"
169
+ version = "1.0.0"
170
+ source = "registry+https://github.com/rust-lang/crates.io-index"
171
+
172
+ [[package]]
173
+ name = "libc"
174
+ version = "0.2.39"
175
+ source = "registry+https://github.com/rust-lang/crates.io-index"
176
+
177
+ [[package]]
178
+ name = "log"
179
+ version = "0.3.9"
180
+ source = "registry+https://github.com/rust-lang/crates.io-index"
181
+ dependencies = [
182
+ "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
183
+ ]
184
+
6
185
  [[package]]
7
186
  name = "log"
8
187
  version = "0.4.1"
@@ -11,14 +190,191 @@ dependencies = [
11
190
  "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
12
191
  ]
13
192
 
193
+ [[package]]
194
+ name = "matches"
195
+ version = "0.1.6"
196
+ source = "registry+https://github.com/rust-lang/crates.io-index"
197
+
198
+ [[package]]
199
+ name = "memchr"
200
+ version = "1.0.2"
201
+ source = "registry+https://github.com/rust-lang/crates.io-index"
202
+ dependencies = [
203
+ "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
204
+ ]
205
+
206
+ [[package]]
207
+ name = "memoffset"
208
+ version = "0.2.1"
209
+ source = "registry+https://github.com/rust-lang/crates.io-index"
210
+
211
+ [[package]]
212
+ name = "mime"
213
+ version = "0.2.6"
214
+ source = "registry+https://github.com/rust-lang/crates.io-index"
215
+ dependencies = [
216
+ "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
217
+ ]
218
+
219
+ [[package]]
220
+ name = "nodrop"
221
+ version = "0.1.12"
222
+ source = "registry+https://github.com/rust-lang/crates.io-index"
223
+
224
+ [[package]]
225
+ name = "num-traits"
226
+ version = "0.2.1"
227
+ source = "registry+https://github.com/rust-lang/crates.io-index"
228
+
229
+ [[package]]
230
+ name = "num_cpus"
231
+ version = "1.8.0"
232
+ source = "registry+https://github.com/rust-lang/crates.io-index"
233
+ dependencies = [
234
+ "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
235
+ ]
236
+
237
+ [[package]]
238
+ name = "ordermap"
239
+ version = "0.2.13"
240
+ source = "registry+https://github.com/rust-lang/crates.io-index"
241
+
242
+ [[package]]
243
+ name = "pear"
244
+ version = "0.0.12"
245
+ source = "registry+https://github.com/rust-lang/crates.io-index"
246
+
247
+ [[package]]
248
+ name = "pear_codegen"
249
+ version = "0.0.12"
250
+ source = "registry+https://github.com/rust-lang/crates.io-index"
251
+ dependencies = [
252
+ "version_check 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
253
+ "yansi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
254
+ ]
255
+
256
+ [[package]]
257
+ name = "percent-encoding"
258
+ version = "1.0.1"
259
+ source = "registry+https://github.com/rust-lang/crates.io-index"
260
+
261
+ [[package]]
262
+ name = "rand"
263
+ version = "0.4.2"
264
+ source = "registry+https://github.com/rust-lang/crates.io-index"
265
+ dependencies = [
266
+ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
267
+ "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
268
+ "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
269
+ ]
270
+
271
+ [[package]]
272
+ name = "rayon"
273
+ version = "0.7.1"
274
+ source = "registry+https://github.com/rust-lang/crates.io-index"
275
+ dependencies = [
276
+ "rayon-core 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
277
+ ]
278
+
279
+ [[package]]
280
+ name = "rayon-core"
281
+ version = "1.4.0"
282
+ source = "registry+https://github.com/rust-lang/crates.io-index"
283
+ dependencies = [
284
+ "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
285
+ "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
286
+ "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
287
+ "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
288
+ "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
289
+ ]
290
+
291
+ [[package]]
292
+ name = "redox_syscall"
293
+ version = "0.1.37"
294
+ source = "registry+https://github.com/rust-lang/crates.io-index"
295
+
296
+ [[package]]
297
+ name = "redox_termios"
298
+ version = "0.1.1"
299
+ source = "registry+https://github.com/rust-lang/crates.io-index"
300
+ dependencies = [
301
+ "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
302
+ ]
303
+
304
+ [[package]]
305
+ name = "ring"
306
+ version = "0.11.0"
307
+ source = "registry+https://github.com/rust-lang/crates.io-index"
308
+ dependencies = [
309
+ "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)",
310
+ "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
311
+ "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
312
+ "rayon 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
313
+ "untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
314
+ ]
315
+
316
+ [[package]]
317
+ name = "rocket"
318
+ version = "0.3.6"
319
+ source = "registry+https://github.com/rust-lang/crates.io-index"
320
+ dependencies = [
321
+ "base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
322
+ "cookie 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
323
+ "hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)",
324
+ "isatty 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
325
+ "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
326
+ "memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
327
+ "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
328
+ "ordermap 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
329
+ "pear 0.0.12 (registry+https://github.com/rust-lang/crates.io-index)",
330
+ "pear_codegen 0.0.12 (registry+https://github.com/rust-lang/crates.io-index)",
331
+ "smallvec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
332
+ "state 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
333
+ "time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)",
334
+ "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
335
+ "url 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
336
+ "version_check 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
337
+ "yansi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
338
+ ]
339
+
340
+ [[package]]
341
+ name = "rocket_codegen"
342
+ version = "0.3.6"
343
+ source = "registry+https://github.com/rust-lang/crates.io-index"
344
+ dependencies = [
345
+ "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
346
+ "rocket 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
347
+ "version_check 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
348
+ "yansi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
349
+ ]
350
+
351
+ [[package]]
352
+ name = "rocket_contrib"
353
+ version = "0.3.6"
354
+ source = "registry+https://github.com/rust-lang/crates.io-index"
355
+ dependencies = [
356
+ "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
357
+ "rocket 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
358
+ "serde 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)",
359
+ "serde_json 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
360
+ ]
361
+
14
362
  [[package]]
15
363
  name = "rust-embed"
16
364
  version = "0.4.0"
17
365
  dependencies = [
18
366
  "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
367
+ "rocket 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
368
+ "rocket_codegen 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
369
+ "rocket_contrib 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
19
370
  "walkdir 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
20
371
  ]
21
372
 
373
+ [[package]]
374
+ name = "safemem"
375
+ version = "0.2.0"
376
+ source = "registry+https://github.com/rust-lang/crates.io-index"
377
+
22
378
  [[package]]
23
379
  name = "same-file"
24
380
  version = "1.0.2"
@@ -27,6 +383,116 @@ dependencies = [
27
383
  "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
28
384
  ]
29
385
 
386
+ [[package]]
387
+ name = "scopeguard"
388
+ version = "0.3.3"
389
+ source = "registry+https://github.com/rust-lang/crates.io-index"
390
+
391
+ [[package]]
392
+ name = "serde"
393
+ version = "1.0.30"
394
+ source = "registry+https://github.com/rust-lang/crates.io-index"
395
+
396
+ [[package]]
397
+ name = "serde_json"
398
+ version = "1.0.11"
399
+ source = "registry+https://github.com/rust-lang/crates.io-index"
400
+ dependencies = [
401
+ "dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
402
+ "itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
403
+ "num-traits 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
404
+ "serde 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)",
405
+ ]
406
+
407
+ [[package]]
408
+ name = "smallvec"
409
+ version = "0.4.4"
410
+ source = "registry+https://github.com/rust-lang/crates.io-index"
411
+
412
+ [[package]]
413
+ name = "state"
414
+ version = "0.3.3"
415
+ source = "registry+https://github.com/rust-lang/crates.io-index"
416
+
417
+ [[package]]
418
+ name = "termion"
419
+ version = "1.5.1"
420
+ source = "registry+https://github.com/rust-lang/crates.io-index"
421
+ dependencies = [
422
+ "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
423
+ "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
424
+ "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
425
+ ]
426
+
427
+ [[package]]
428
+ name = "time"
429
+ version = "0.1.39"
430
+ source = "registry+https://github.com/rust-lang/crates.io-index"
431
+ dependencies = [
432
+ "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
433
+ "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
434
+ "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
435
+ ]
436
+
437
+ [[package]]
438
+ name = "toml"
439
+ version = "0.4.5"
440
+ source = "registry+https://github.com/rust-lang/crates.io-index"
441
+ dependencies = [
442
+ "serde 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)",
443
+ ]
444
+
445
+ [[package]]
446
+ name = "traitobject"
447
+ version = "0.1.0"
448
+ source = "registry+https://github.com/rust-lang/crates.io-index"
449
+
450
+ [[package]]
451
+ name = "typeable"
452
+ version = "0.1.2"
453
+ source = "registry+https://github.com/rust-lang/crates.io-index"
454
+
455
+ [[package]]
456
+ name = "unicase"
457
+ version = "1.4.2"
458
+ source = "registry+https://github.com/rust-lang/crates.io-index"
459
+ dependencies = [
460
+ "version_check 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
461
+ ]
462
+
463
+ [[package]]
464
+ name = "unicode-bidi"
465
+ version = "0.3.4"
466
+ source = "registry+https://github.com/rust-lang/crates.io-index"
467
+ dependencies = [
468
+ "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
469
+ ]
470
+
471
+ [[package]]
472
+ name = "unicode-normalization"
473
+ version = "0.1.5"
474
+ source = "registry+https://github.com/rust-lang/crates.io-index"
475
+
476
+ [[package]]
477
+ name = "untrusted"
478
+ version = "0.5.1"
479
+ source = "registry+https://github.com/rust-lang/crates.io-index"
480
+
481
+ [[package]]
482
+ name = "url"
483
+ version = "1.7.0"
484
+ source = "registry+https://github.com/rust-lang/crates.io-index"
485
+ dependencies = [
486
+ "idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
487
+ "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
488
+ "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
489
+ ]
490
+
491
+ [[package]]
492
+ name = "version_check"
493
+ version = "0.1.3"
494
+ source = "registry+https://github.com/rust-lang/crates.io-index"
495
+
30
496
  [[package]]
31
497
  name = "walkdir"
32
498
  version = "2.1.4"
@@ -36,6 +502,11 @@ dependencies = [
36
502
  "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
37
503
  ]
38
504
 
505
+ [[package]]
506
+ name = "winapi"
507
+ version = "0.2.8"
508
+ source = "registry+https://github.com/rust-lang/crates.io-index"
509
+
39
510
  [[package]]
40
511
  name = "winapi"
41
512
  version = "0.3.4"
@@ -45,6 +516,11 @@ dependencies = [
45
516
  "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
46
517
  ]
47
518
 
519
+ [[package]]
520
+ name = "winapi-build"
521
+ version = "0.1.1"
522
+ source = "registry+https://github.com/rust-lang/crates.io-index"
523
+
48
524
  [[package]]
49
525
  name = "winapi-i686-pc-windows-gnu"
50
526
  version = "0.4.0"
@@ -55,11 +531,79 @@ name = "winapi-x86_64-pc-windows-gnu"
55
531
  version = "0.4.0"
56
532
  source = "registry+https://github.com/rust-lang/crates.io-index"
57
533
 
534
+ [[package]]
535
+ name = "yansi"
536
+ version = "0.3.4"
537
+ source = "registry+https://github.com/rust-lang/crates.io-index"
538
+
58
539
  [metadata]
540
+ "checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef"
541
+ "checksum base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "96434f987501f0ed4eb336a411e0631ecd1afa11574fe148587adc4ff96143c9"
542
+ "checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf"
543
+ "checksum byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23"
59
544
  "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"
545
+ "checksum cookie 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "477eb650753e319be2ae77ec368a58c638f9f0c4d941c39bad95e950fb1d1d0d"
546
+ "checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3"
547
+ "checksum crossbeam-epoch 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "59796cc6cbbdc6bb319161349db0c3250ec73ec7fcb763a51065ec4e2e158552"
548
+ "checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9"
549
+ "checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab"
550
+ "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
551
+ "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
552
+ "checksum gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)" = "5e33ec290da0d127825013597dbdfc28bee4964690c7ce1166cbc2a7bd08b1bb"
553
+ "checksum httparse 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2f407128745b78abc95c0ffbe4e5d37427fdc0d45470710cfef8c44522a2e37"
554
+ "checksum hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)" = "368cb56b2740ebf4230520e2b90ebb0461e69034d85d1945febd9b3971426db2"
555
+ "checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d"
556
+ "checksum isatty 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8f2a233726c7bb76995cec749d59582e5664823b7245d4970354408f1d79a7a2"
557
+ "checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c"
558
+ "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
559
+ "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a"
560
+ "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
561
+ "checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d"
562
+ "checksum libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)" = "f54263ad99207254cf58b5f701ecb432c717445ea2ee8af387334bdd1a03fdff"
563
+ "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
60
564
  "checksum log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2"
565
+ "checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376"
566
+ "checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a"
567
+ "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3"
568
+ "checksum mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0"
569
+ "checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2"
570
+ "checksum num-traits 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3c2bd9b9d21e48e956b763c9f37134dc62d9e95da6edb3f672cacb6caf3cd3"
571
+ "checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30"
572
+ "checksum ordermap 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b81cf3b8cb96aa0e73bbedfcdc9708d09fec2854ba8d474be4e6f666d7379e8b"
573
+ "checksum pear 0.0.12 (registry+https://github.com/rust-lang/crates.io-index)" = "b5c2dabd6c1650d9bfac8e46be7b518b31c3885ab4412de1aca330938616c5bd"
574
+ "checksum pear_codegen 0.0.12 (registry+https://github.com/rust-lang/crates.io-index)" = "df863bb78b3ee6b049278324eea8df6b2553a8db9a3504c0e32cfcc17bc8d18c"
575
+ "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
576
+ "checksum rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5"
577
+ "checksum rayon 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a77c51c07654ddd93f6cb543c7a849863b03abc7e82591afda6dc8ad4ac3ac4a"
578
+ "checksum rayon-core 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9d24ad214285a7729b174ed6d3bcfcb80177807f959d95fafd5bfc5c4f201ac8"
579
+ "checksum redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd"
580
+ "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
581
+ "checksum ring 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1f2a6dc7fc06a05e6de183c5b97058582e9da2de0c136eafe49609769c507724"
582
+ "checksum rocket 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "531c93452333bc5a13d3cbd776a8cac299215ba23be1583fdb307fef75ae0516"
583
+ "checksum rocket_codegen 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a7ad25afa7baa27347981fc4d450713d1d9f7533fd5a0c4664519fe661bcd827"
584
+ "checksum rocket_contrib 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f8c65e9bac3d41a9011adb4adccc819ab4a182657eb5cd478fd0e2a3c1eb7dfe"
585
+ "checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f"
61
586
  "checksum same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cfb6eded0b06a0b512c8ddbcf04089138c9b4362c2f696f3c3d76039d68f3637"
587
+ "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
588
+ "checksum serde 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)" = "1f4d6340aa5fcdac490a1aa3511ff079b1cdaa45ffb766b2fd83395dae085cd5"
589
+ "checksum serde_json 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "fab6c4d75bedcf880711c85e39ebf8ccc70d0eba259899047ec5d7436643ee17"
590
+ "checksum smallvec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ee4f357e8cd37bf8822e1b964e96fd39e2cb5a0424f8aaa284ccaccc2162411c"
591
+ "checksum state 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e2fe297055568778ddc83eb1d4292bcdab36bf9e5e7adf4d0ce4ee59caf778d9"
592
+ "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
593
+ "checksum time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "a15375f1df02096fb3317256ce2cee6a1f42fc84ea5ad5fc8c421cfe40c73098"
594
+ "checksum toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a7540f4ffc193e0d3c94121edb19b055670d369f77d5804db11ae053a45b6e7e"
595
+ "checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079"
596
+ "checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887"
597
+ "checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33"
598
+ "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
599
+ "checksum unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "51ccda9ef9efa3f7ef5d91e8f9b83bbe6955f9bf86aec89d5cce2c874625920f"
600
+ "checksum untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f392d7819dbe58833e26872f5f6f0d68b7bbbe90fc3667e98731c4a15ad9a7ae"
601
+ "checksum url 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f808aadd8cfec6ef90e4a14eb46f24511824d1ac596b9682703c87056c8678b7"
602
+ "checksum version_check 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6b772017e347561807c1aa192438c5fd74242a670a6cffacc40f2defd1dc069d"
62
603
  "checksum walkdir 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "63636bd0eb3d00ccb8b9036381b526efac53caf112b7783b730ab3f8e44da369"
604
+ "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
63
605
  "checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3"
606
+ "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
64
607
  "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
65
608
  "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
609
+ "checksum yansi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a503e4eea629f145a693c8ed1eddba88b3b9de5171c6ebd0e2820cf82d38f934"
Cargo.toml CHANGED
@@ -16,3 +16,8 @@ plugin = true
16
16
  [dependencies]
17
17
  log = "0.4"
18
18
  walkdir = "2.1.4"
19
+
20
+ [dev-dependencies]
21
+ rocket = "0.3.6"
22
+ rocket_codegen = "0.3.6"
23
+ rocket_contrib = "0.3.6"
examples/public/index.html CHANGED
@@ -1,14 +1,14 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <link rel="stylesheet" type="text/css" href="examples/public/main.css" />
4
+ <link rel="stylesheet" type="text/css" href="dist/main.css" />
5
- <script src="examples/public/main.js"></script>
5
+ <script src="dist/main.js"></script>
6
6
  </head>
7
7
  <body>
8
8
  <div class="bor">
9
9
  <table bgcolor=#f0f0f0 cellspacing=0 class="hh">
10
10
  <tr>
11
- <td><img src="examples/public/images/llama.png" align="left"></td>
11
+ <td><img src="dist/images/llama.png" align="left"></td>
12
12
  <td>
13
13
  <table cellspacing=0>
14
14
  <tr><td><b>pyros2097</b></td></tr>
examples/rocket.rs ADDED
@@ -0,0 +1,46 @@
1
+ #![feature(test, plugin, decl_macro)]
2
+ #![plugin(rocket_codegen)]
3
+ extern crate rocket;
4
+ extern crate rocket_contrib;
5
+ extern crate rust_embed;
6
+
7
+ use std::path::PathBuf;
8
+ use std::io::Cursor;
9
+ use rocket::response;
10
+ use rocket::http::{ContentType, Status};
11
+ use rust_embed::*;
12
+
13
+ #[get("/")]
14
+ fn index<'r>() -> response::Result<'r> {
15
+ let asset = embed!("examples/public".to_owned());
16
+ asset("/index.html".to_owned()).map_or_else(
17
+ || Err(Status::NotFound),
18
+ |d| {
19
+ response::Response::build()
20
+ .header(ContentType::HTML)
21
+ .sized_body(Cursor::new(d))
22
+ .ok()
23
+ },
24
+ )
25
+ }
26
+
27
+ #[get("/dist/<file..>")]
28
+ fn dist<'r>(file: PathBuf) -> response::Result<'r> {
29
+ let filename = file.display().to_string();
30
+ let asset = embed!("examples/public/".to_owned());
31
+ // let ext = Path::new(&filename).extension().and_then(OsStr::to_str).expect("Could not get file extension");
32
+ // let content_type = ContentType::from_extension(ext).expect("Could not get file content type");
33
+ asset(filename.clone()).map_or_else(
34
+ || Err(Status::NotFound),
35
+ |d| {
36
+ response::Response::build()
37
+ .header(ContentType::HTML)
38
+ .sized_body(Cursor::new(d))
39
+ .ok()
40
+ },
41
+ )
42
+ }
43
+
44
+ fn main() {
45
+ rocket::ignite().mount("/", routes![index, dist]).launch();
46
+ }
readme.md CHANGED
@@ -44,7 +44,7 @@ fn main() {
44
44
 
45
45
  ## Examples
46
46
  To run the examples,
47
- `cargo run --example hyper`
47
+ `cargo run --example rocket`
48
48
 
49
49
  ## Testing
50
50
  debug: `cargo test --lib