Technical test for a job interview.

first commit

vylion 1a9bf118

+1
.gitignore
··· 1 + /target
+1681
Cargo.lock
··· 1 + # This file is automatically @generated by Cargo. 2 + # It is not intended for manual editing. 3 + [[package]] 4 + name = "aead" 5 + version = "0.2.0" 6 + source = "registry+https://github.com/rust-lang/crates.io-index" 7 + checksum = "4cf01b9b56e767bb57b94ebf91a58b338002963785cdd7013e21c0d4679471e4" 8 + dependencies = [ 9 + "generic-array", 10 + ] 11 + 12 + [[package]] 13 + name = "aes" 14 + version = "0.3.2" 15 + source = "registry+https://github.com/rust-lang/crates.io-index" 16 + checksum = "54eb1d8fe354e5fc611daf4f2ea97dd45a765f4f1e4512306ec183ae2e8f20c9" 17 + dependencies = [ 18 + "aes-soft", 19 + "aesni", 20 + "block-cipher-trait", 21 + ] 22 + 23 + [[package]] 24 + name = "aes-gcm" 25 + version = "0.5.0" 26 + source = "registry+https://github.com/rust-lang/crates.io-index" 27 + checksum = "834a6bda386024dbb7c8fc51322856c10ffe69559f972261c868485f5759c638" 28 + dependencies = [ 29 + "aead", 30 + "aes", 31 + "block-cipher-trait", 32 + "ghash", 33 + "subtle 2.3.0", 34 + "zeroize", 35 + ] 36 + 37 + [[package]] 38 + name = "aes-soft" 39 + version = "0.3.3" 40 + source = "registry+https://github.com/rust-lang/crates.io-index" 41 + checksum = "cfd7e7ae3f9a1fb5c03b389fc6bb9a51400d0c13053f0dca698c832bfd893a0d" 42 + dependencies = [ 43 + "block-cipher-trait", 44 + "byteorder", 45 + "opaque-debug", 46 + ] 47 + 48 + [[package]] 49 + name = "aesni" 50 + version = "0.6.0" 51 + source = "registry+https://github.com/rust-lang/crates.io-index" 52 + checksum = "2f70a6b5f971e473091ab7cfb5ffac6cde81666c4556751d8d5620ead8abf100" 53 + dependencies = [ 54 + "block-cipher-trait", 55 + "opaque-debug", 56 + ] 57 + 58 + [[package]] 59 + name = "arc-swap" 60 + version = "0.4.7" 61 + source = "registry+https://github.com/rust-lang/crates.io-index" 62 + checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" 63 + 64 + [[package]] 65 + name = "atty" 66 + version = "0.2.14" 67 + source = "registry+https://github.com/rust-lang/crates.io-index" 68 + checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 69 + dependencies = [ 70 + "hermit-abi", 71 + "libc", 72 + "winapi 0.3.9", 73 + ] 74 + 75 + [[package]] 76 + name = "autocfg" 77 + version = "1.0.1" 78 + source = "registry+https://github.com/rust-lang/crates.io-index" 79 + checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" 80 + 81 + [[package]] 82 + name = "base64" 83 + version = "0.9.3" 84 + source = "registry+https://github.com/rust-lang/crates.io-index" 85 + checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" 86 + dependencies = [ 87 + "byteorder", 88 + "safemem", 89 + ] 90 + 91 + [[package]] 92 + name = "base64" 93 + version = "0.12.3" 94 + source = "registry+https://github.com/rust-lang/crates.io-index" 95 + checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" 96 + 97 + [[package]] 98 + name = "bitflags" 99 + version = "1.2.1" 100 + source = "registry+https://github.com/rust-lang/crates.io-index" 101 + checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" 102 + 103 + [[package]] 104 + name = "block-buffer" 105 + version = "0.7.3" 106 + source = "registry+https://github.com/rust-lang/crates.io-index" 107 + checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" 108 + dependencies = [ 109 + "block-padding", 110 + "byte-tools", 111 + "byteorder", 112 + "generic-array", 113 + ] 114 + 115 + [[package]] 116 + name = "block-cipher-trait" 117 + version = "0.6.2" 118 + source = "registry+https://github.com/rust-lang/crates.io-index" 119 + checksum = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774" 120 + dependencies = [ 121 + "generic-array", 122 + ] 123 + 124 + [[package]] 125 + name = "block-padding" 126 + version = "0.1.5" 127 + source = "registry+https://github.com/rust-lang/crates.io-index" 128 + checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" 129 + dependencies = [ 130 + "byte-tools", 131 + ] 132 + 133 + [[package]] 134 + name = "bumpalo" 135 + version = "3.4.0" 136 + source = "registry+https://github.com/rust-lang/crates.io-index" 137 + checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" 138 + 139 + [[package]] 140 + name = "byte-tools" 141 + version = "0.3.1" 142 + source = "registry+https://github.com/rust-lang/crates.io-index" 143 + checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" 144 + 145 + [[package]] 146 + name = "byteorder" 147 + version = "1.3.4" 148 + source = "registry+https://github.com/rust-lang/crates.io-index" 149 + checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" 150 + 151 + [[package]] 152 + name = "bytes" 153 + version = "0.5.6" 154 + source = "registry+https://github.com/rust-lang/crates.io-index" 155 + checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" 156 + 157 + [[package]] 158 + name = "cc" 159 + version = "1.0.60" 160 + source = "registry+https://github.com/rust-lang/crates.io-index" 161 + checksum = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c" 162 + 163 + [[package]] 164 + name = "cfg-if" 165 + version = "0.1.10" 166 + source = "registry+https://github.com/rust-lang/crates.io-index" 167 + checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" 168 + 169 + [[package]] 170 + name = "cookie" 171 + version = "0.11.3" 172 + source = "registry+https://github.com/rust-lang/crates.io-index" 173 + checksum = "5795cda0897252e34380a27baf884c53aa7ad9990329cdad96d4c5d027015d44" 174 + dependencies = [ 175 + "aes-gcm", 176 + "base64 0.12.3", 177 + "hkdf", 178 + "hmac", 179 + "percent-encoding 2.1.0", 180 + "rand", 181 + "sha2", 182 + "time", 183 + ] 184 + 185 + [[package]] 186 + name = "core-foundation" 187 + version = "0.7.0" 188 + source = "registry+https://github.com/rust-lang/crates.io-index" 189 + checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" 190 + dependencies = [ 191 + "core-foundation-sys", 192 + "libc", 193 + ] 194 + 195 + [[package]] 196 + name = "core-foundation-sys" 197 + version = "0.7.0" 198 + source = "registry+https://github.com/rust-lang/crates.io-index" 199 + checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" 200 + 201 + [[package]] 202 + name = "crypto-mac" 203 + version = "0.7.0" 204 + source = "registry+https://github.com/rust-lang/crates.io-index" 205 + checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" 206 + dependencies = [ 207 + "generic-array", 208 + "subtle 1.0.0", 209 + ] 210 + 211 + [[package]] 212 + name = "devise" 213 + version = "0.2.0" 214 + source = "registry+https://github.com/rust-lang/crates.io-index" 215 + checksum = "74e04ba2d03c5fa0d954c061fc8c9c288badadffc272ebb87679a89846de3ed3" 216 + dependencies = [ 217 + "devise_codegen", 218 + "devise_core", 219 + ] 220 + 221 + [[package]] 222 + name = "devise_codegen" 223 + version = "0.2.0" 224 + source = "registry+https://github.com/rust-lang/crates.io-index" 225 + checksum = "066ceb7928ca93a9bedc6d0e612a8a0424048b0ab1f75971b203d01420c055d7" 226 + dependencies = [ 227 + "devise_core", 228 + "quote 0.6.13", 229 + ] 230 + 231 + [[package]] 232 + name = "devise_core" 233 + version = "0.2.0" 234 + source = "registry+https://github.com/rust-lang/crates.io-index" 235 + checksum = "cf41c59b22b5e3ec0ea55c7847e5f358d340f3a8d6d53a5cf4f1564967f96487" 236 + dependencies = [ 237 + "bitflags", 238 + "proc-macro2 0.4.30", 239 + "quote 0.6.13", 240 + "syn 0.15.44", 241 + ] 242 + 243 + [[package]] 244 + name = "digest" 245 + version = "0.8.1" 246 + source = "registry+https://github.com/rust-lang/crates.io-index" 247 + checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" 248 + dependencies = [ 249 + "generic-array", 250 + ] 251 + 252 + [[package]] 253 + name = "dtoa" 254 + version = "0.4.6" 255 + source = "registry+https://github.com/rust-lang/crates.io-index" 256 + checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b" 257 + 258 + [[package]] 259 + name = "encoding_rs" 260 + version = "0.8.24" 261 + source = "registry+https://github.com/rust-lang/crates.io-index" 262 + checksum = "a51b8cf747471cb9499b6d59e59b0444f4c90eba8968c4e44874e92b5b64ace2" 263 + dependencies = [ 264 + "cfg-if", 265 + ] 266 + 267 + [[package]] 268 + name = "fake-simd" 269 + version = "0.1.2" 270 + source = "registry+https://github.com/rust-lang/crates.io-index" 271 + checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" 272 + 273 + [[package]] 274 + name = "fnv" 275 + version = "1.0.7" 276 + source = "registry+https://github.com/rust-lang/crates.io-index" 277 + checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 278 + 279 + [[package]] 280 + name = "foreign-types" 281 + version = "0.3.2" 282 + source = "registry+https://github.com/rust-lang/crates.io-index" 283 + checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" 284 + dependencies = [ 285 + "foreign-types-shared", 286 + ] 287 + 288 + [[package]] 289 + name = "foreign-types-shared" 290 + version = "0.1.1" 291 + source = "registry+https://github.com/rust-lang/crates.io-index" 292 + checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" 293 + 294 + [[package]] 295 + name = "fuchsia-zircon" 296 + version = "0.3.3" 297 + source = "registry+https://github.com/rust-lang/crates.io-index" 298 + checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" 299 + dependencies = [ 300 + "bitflags", 301 + "fuchsia-zircon-sys", 302 + ] 303 + 304 + [[package]] 305 + name = "fuchsia-zircon-sys" 306 + version = "0.3.3" 307 + source = "registry+https://github.com/rust-lang/crates.io-index" 308 + checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" 309 + 310 + [[package]] 311 + name = "futures-channel" 312 + version = "0.3.5" 313 + source = "registry+https://github.com/rust-lang/crates.io-index" 314 + checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5" 315 + dependencies = [ 316 + "futures-core", 317 + ] 318 + 319 + [[package]] 320 + name = "futures-core" 321 + version = "0.3.5" 322 + source = "registry+https://github.com/rust-lang/crates.io-index" 323 + checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399" 324 + 325 + [[package]] 326 + name = "futures-io" 327 + version = "0.3.5" 328 + source = "registry+https://github.com/rust-lang/crates.io-index" 329 + checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789" 330 + 331 + [[package]] 332 + name = "futures-sink" 333 + version = "0.3.5" 334 + source = "registry+https://github.com/rust-lang/crates.io-index" 335 + checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc" 336 + 337 + [[package]] 338 + name = "futures-task" 339 + version = "0.3.5" 340 + source = "registry+https://github.com/rust-lang/crates.io-index" 341 + checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626" 342 + dependencies = [ 343 + "once_cell", 344 + ] 345 + 346 + [[package]] 347 + name = "futures-util" 348 + version = "0.3.5" 349 + source = "registry+https://github.com/rust-lang/crates.io-index" 350 + checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" 351 + dependencies = [ 352 + "futures-core", 353 + "futures-io", 354 + "futures-task", 355 + "memchr", 356 + "pin-project", 357 + "pin-utils", 358 + "slab", 359 + ] 360 + 361 + [[package]] 362 + name = "generic-array" 363 + version = "0.12.3" 364 + source = "registry+https://github.com/rust-lang/crates.io-index" 365 + checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" 366 + dependencies = [ 367 + "typenum", 368 + ] 369 + 370 + [[package]] 371 + name = "getrandom" 372 + version = "0.1.15" 373 + source = "registry+https://github.com/rust-lang/crates.io-index" 374 + checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" 375 + dependencies = [ 376 + "cfg-if", 377 + "libc", 378 + "wasi 0.9.0+wasi-snapshot-preview1", 379 + ] 380 + 381 + [[package]] 382 + name = "ghash" 383 + version = "0.2.3" 384 + source = "registry+https://github.com/rust-lang/crates.io-index" 385 + checksum = "9f0930ed19a7184089ea46d2fedead2f6dc2b674c5db4276b7da336c7cd83252" 386 + dependencies = [ 387 + "polyval", 388 + ] 389 + 390 + [[package]] 391 + name = "glob" 392 + version = "0.3.0" 393 + source = "registry+https://github.com/rust-lang/crates.io-index" 394 + checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" 395 + 396 + [[package]] 397 + name = "h2" 398 + version = "0.2.6" 399 + source = "registry+https://github.com/rust-lang/crates.io-index" 400 + checksum = "993f9e0baeed60001cf565546b0d3dbe6a6ad23f2bd31644a133c641eccf6d53" 401 + dependencies = [ 402 + "bytes", 403 + "fnv", 404 + "futures-core", 405 + "futures-sink", 406 + "futures-util", 407 + "http", 408 + "indexmap", 409 + "slab", 410 + "tokio", 411 + "tokio-util", 412 + "tracing", 413 + ] 414 + 415 + [[package]] 416 + name = "hashbrown" 417 + version = "0.9.0" 418 + source = "registry+https://github.com/rust-lang/crates.io-index" 419 + checksum = "00d63df3d41950fb462ed38308eea019113ad1508da725bbedcd0fa5a85ef5f7" 420 + 421 + [[package]] 422 + name = "hermit-abi" 423 + version = "0.1.15" 424 + source = "registry+https://github.com/rust-lang/crates.io-index" 425 + checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9" 426 + dependencies = [ 427 + "libc", 428 + ] 429 + 430 + [[package]] 431 + name = "hkdf" 432 + version = "0.8.0" 433 + source = "registry+https://github.com/rust-lang/crates.io-index" 434 + checksum = "3fa08a006102488bd9cd5b8013aabe84955cf5ae22e304c2caf655b633aefae3" 435 + dependencies = [ 436 + "digest", 437 + "hmac", 438 + ] 439 + 440 + [[package]] 441 + name = "hmac" 442 + version = "0.7.1" 443 + source = "registry+https://github.com/rust-lang/crates.io-index" 444 + checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" 445 + dependencies = [ 446 + "crypto-mac", 447 + "digest", 448 + ] 449 + 450 + [[package]] 451 + name = "http" 452 + version = "0.2.1" 453 + source = "registry+https://github.com/rust-lang/crates.io-index" 454 + checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" 455 + dependencies = [ 456 + "bytes", 457 + "fnv", 458 + "itoa", 459 + ] 460 + 461 + [[package]] 462 + name = "http-body" 463 + version = "0.3.1" 464 + source = "registry+https://github.com/rust-lang/crates.io-index" 465 + checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" 466 + dependencies = [ 467 + "bytes", 468 + "http", 469 + ] 470 + 471 + [[package]] 472 + name = "httparse" 473 + version = "1.3.4" 474 + source = "registry+https://github.com/rust-lang/crates.io-index" 475 + checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" 476 + 477 + [[package]] 478 + name = "httpdate" 479 + version = "0.3.2" 480 + source = "registry+https://github.com/rust-lang/crates.io-index" 481 + checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" 482 + 483 + [[package]] 484 + name = "hyper" 485 + version = "0.10.16" 486 + source = "registry+https://github.com/rust-lang/crates.io-index" 487 + checksum = "0a0652d9a2609a968c14be1a9ea00bf4b1d64e2e1f53a1b51b6fff3a6e829273" 488 + dependencies = [ 489 + "base64 0.9.3", 490 + "httparse", 491 + "language-tags", 492 + "log 0.3.9", 493 + "mime 0.2.6", 494 + "num_cpus", 495 + "time", 496 + "traitobject", 497 + "typeable", 498 + "unicase 1.4.2", 499 + "url 1.7.2", 500 + ] 501 + 502 + [[package]] 503 + name = "hyper" 504 + version = "0.13.8" 505 + source = "registry+https://github.com/rust-lang/crates.io-index" 506 + checksum = "2f3afcfae8af5ad0576a31e768415edb627824129e8e5a29b8bfccb2f234e835" 507 + dependencies = [ 508 + "bytes", 509 + "futures-channel", 510 + "futures-core", 511 + "futures-util", 512 + "h2", 513 + "http", 514 + "http-body", 515 + "httparse", 516 + "httpdate", 517 + "itoa", 518 + "pin-project", 519 + "socket2", 520 + "tokio", 521 + "tower-service", 522 + "tracing", 523 + "want", 524 + ] 525 + 526 + [[package]] 527 + name = "hyper-tls" 528 + version = "0.4.3" 529 + source = "registry+https://github.com/rust-lang/crates.io-index" 530 + checksum = "d979acc56dcb5b8dddba3917601745e877576475aa046df3226eabdecef78eed" 531 + dependencies = [ 532 + "bytes", 533 + "hyper 0.13.8", 534 + "native-tls", 535 + "tokio", 536 + "tokio-tls", 537 + ] 538 + 539 + [[package]] 540 + name = "idna" 541 + version = "0.1.5" 542 + source = "registry+https://github.com/rust-lang/crates.io-index" 543 + checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" 544 + dependencies = [ 545 + "matches", 546 + "unicode-bidi", 547 + "unicode-normalization", 548 + ] 549 + 550 + [[package]] 551 + name = "idna" 552 + version = "0.2.0" 553 + source = "registry+https://github.com/rust-lang/crates.io-index" 554 + checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" 555 + dependencies = [ 556 + "matches", 557 + "unicode-bidi", 558 + "unicode-normalization", 559 + ] 560 + 561 + [[package]] 562 + name = "indexmap" 563 + version = "1.6.0" 564 + source = "registry+https://github.com/rust-lang/crates.io-index" 565 + checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2" 566 + dependencies = [ 567 + "autocfg", 568 + "hashbrown", 569 + ] 570 + 571 + [[package]] 572 + name = "iovec" 573 + version = "0.1.4" 574 + source = "registry+https://github.com/rust-lang/crates.io-index" 575 + checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" 576 + dependencies = [ 577 + "libc", 578 + ] 579 + 580 + [[package]] 581 + name = "ipnet" 582 + version = "2.3.0" 583 + source = "registry+https://github.com/rust-lang/crates.io-index" 584 + checksum = "47be2f14c678be2fdcab04ab1171db51b2762ce6f0a8ee87c8dd4a04ed216135" 585 + 586 + [[package]] 587 + name = "itoa" 588 + version = "0.4.6" 589 + source = "registry+https://github.com/rust-lang/crates.io-index" 590 + checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" 591 + 592 + [[package]] 593 + name = "js-sys" 594 + version = "0.3.45" 595 + source = "registry+https://github.com/rust-lang/crates.io-index" 596 + checksum = "ca059e81d9486668f12d455a4ea6daa600bd408134cd17e3d3fb5a32d1f016f8" 597 + dependencies = [ 598 + "wasm-bindgen", 599 + ] 600 + 601 + [[package]] 602 + name = "kernel32-sys" 603 + version = "0.2.2" 604 + source = "registry+https://github.com/rust-lang/crates.io-index" 605 + checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" 606 + dependencies = [ 607 + "winapi 0.2.8", 608 + "winapi-build", 609 + ] 610 + 611 + [[package]] 612 + name = "language-tags" 613 + version = "0.2.2" 614 + source = "registry+https://github.com/rust-lang/crates.io-index" 615 + checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" 616 + 617 + [[package]] 618 + name = "lazy_static" 619 + version = "1.4.0" 620 + source = "registry+https://github.com/rust-lang/crates.io-index" 621 + checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 622 + 623 + [[package]] 624 + name = "libc" 625 + version = "0.2.77" 626 + source = "registry+https://github.com/rust-lang/crates.io-index" 627 + checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235" 628 + 629 + [[package]] 630 + name = "log" 631 + version = "0.3.9" 632 + source = "registry+https://github.com/rust-lang/crates.io-index" 633 + checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" 634 + dependencies = [ 635 + "log 0.4.11", 636 + ] 637 + 638 + [[package]] 639 + name = "log" 640 + version = "0.4.11" 641 + source = "registry+https://github.com/rust-lang/crates.io-index" 642 + checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" 643 + dependencies = [ 644 + "cfg-if", 645 + ] 646 + 647 + [[package]] 648 + name = "matches" 649 + version = "0.1.8" 650 + source = "registry+https://github.com/rust-lang/crates.io-index" 651 + checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" 652 + 653 + [[package]] 654 + name = "memchr" 655 + version = "2.3.3" 656 + source = "registry+https://github.com/rust-lang/crates.io-index" 657 + checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" 658 + 659 + [[package]] 660 + name = "mime" 661 + version = "0.2.6" 662 + source = "registry+https://github.com/rust-lang/crates.io-index" 663 + checksum = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" 664 + dependencies = [ 665 + "log 0.3.9", 666 + ] 667 + 668 + [[package]] 669 + name = "mime" 670 + version = "0.3.16" 671 + source = "registry+https://github.com/rust-lang/crates.io-index" 672 + checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" 673 + 674 + [[package]] 675 + name = "mime_guess" 676 + version = "2.0.3" 677 + source = "registry+https://github.com/rust-lang/crates.io-index" 678 + checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" 679 + dependencies = [ 680 + "mime 0.3.16", 681 + "unicase 2.6.0", 682 + ] 683 + 684 + [[package]] 685 + name = "mio" 686 + version = "0.6.22" 687 + source = "registry+https://github.com/rust-lang/crates.io-index" 688 + checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" 689 + dependencies = [ 690 + "cfg-if", 691 + "fuchsia-zircon", 692 + "fuchsia-zircon-sys", 693 + "iovec", 694 + "kernel32-sys", 695 + "libc", 696 + "log 0.4.11", 697 + "miow 0.2.1", 698 + "net2", 699 + "slab", 700 + "winapi 0.2.8", 701 + ] 702 + 703 + [[package]] 704 + name = "mio-named-pipes" 705 + version = "0.1.7" 706 + source = "registry+https://github.com/rust-lang/crates.io-index" 707 + checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" 708 + dependencies = [ 709 + "log 0.4.11", 710 + "mio", 711 + "miow 0.3.5", 712 + "winapi 0.3.9", 713 + ] 714 + 715 + [[package]] 716 + name = "mio-uds" 717 + version = "0.6.8" 718 + source = "registry+https://github.com/rust-lang/crates.io-index" 719 + checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" 720 + dependencies = [ 721 + "iovec", 722 + "libc", 723 + "mio", 724 + ] 725 + 726 + [[package]] 727 + name = "miow" 728 + version = "0.2.1" 729 + source = "registry+https://github.com/rust-lang/crates.io-index" 730 + checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" 731 + dependencies = [ 732 + "kernel32-sys", 733 + "net2", 734 + "winapi 0.2.8", 735 + "ws2_32-sys", 736 + ] 737 + 738 + [[package]] 739 + name = "miow" 740 + version = "0.3.5" 741 + source = "registry+https://github.com/rust-lang/crates.io-index" 742 + checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e" 743 + dependencies = [ 744 + "socket2", 745 + "winapi 0.3.9", 746 + ] 747 + 748 + [[package]] 749 + name = "native-tls" 750 + version = "0.2.4" 751 + source = "registry+https://github.com/rust-lang/crates.io-index" 752 + checksum = "2b0d88c06fe90d5ee94048ba40409ef1d9315d86f6f38c2efdaad4fb50c58b2d" 753 + dependencies = [ 754 + "lazy_static", 755 + "libc", 756 + "log 0.4.11", 757 + "openssl", 758 + "openssl-probe", 759 + "openssl-sys", 760 + "schannel", 761 + "security-framework", 762 + "security-framework-sys", 763 + "tempfile", 764 + ] 765 + 766 + [[package]] 767 + name = "net2" 768 + version = "0.2.35" 769 + source = "registry+https://github.com/rust-lang/crates.io-index" 770 + checksum = "3ebc3ec692ed7c9a255596c67808dee269f64655d8baf7b4f0638e51ba1d6853" 771 + dependencies = [ 772 + "cfg-if", 773 + "libc", 774 + "winapi 0.3.9", 775 + ] 776 + 777 + [[package]] 778 + name = "num_cpus" 779 + version = "1.13.0" 780 + source = "registry+https://github.com/rust-lang/crates.io-index" 781 + checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" 782 + dependencies = [ 783 + "hermit-abi", 784 + "libc", 785 + ] 786 + 787 + [[package]] 788 + name = "once_cell" 789 + version = "1.4.1" 790 + source = "registry+https://github.com/rust-lang/crates.io-index" 791 + checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad" 792 + 793 + [[package]] 794 + name = "opaque-debug" 795 + version = "0.2.3" 796 + source = "registry+https://github.com/rust-lang/crates.io-index" 797 + checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" 798 + 799 + [[package]] 800 + name = "openssl" 801 + version = "0.10.30" 802 + source = "registry+https://github.com/rust-lang/crates.io-index" 803 + checksum = "8d575eff3665419f9b83678ff2815858ad9d11567e082f5ac1814baba4e2bcb4" 804 + dependencies = [ 805 + "bitflags", 806 + "cfg-if", 807 + "foreign-types", 808 + "lazy_static", 809 + "libc", 810 + "openssl-sys", 811 + ] 812 + 813 + [[package]] 814 + name = "openssl-probe" 815 + version = "0.1.2" 816 + source = "registry+https://github.com/rust-lang/crates.io-index" 817 + checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" 818 + 819 + [[package]] 820 + name = "openssl-sys" 821 + version = "0.9.58" 822 + source = "registry+https://github.com/rust-lang/crates.io-index" 823 + checksum = "a842db4709b604f0fe5d1170ae3565899be2ad3d9cbc72dedc789ac0511f78de" 824 + dependencies = [ 825 + "autocfg", 826 + "cc", 827 + "libc", 828 + "pkg-config", 829 + "vcpkg", 830 + ] 831 + 832 + [[package]] 833 + name = "pear" 834 + version = "0.1.4" 835 + source = "registry+https://github.com/rust-lang/crates.io-index" 836 + checksum = "5320f212db967792b67cfe12bd469d08afd6318a249bd917d5c19bc92200ab8a" 837 + dependencies = [ 838 + "pear_codegen", 839 + ] 840 + 841 + [[package]] 842 + name = "pear_codegen" 843 + version = "0.1.4" 844 + source = "registry+https://github.com/rust-lang/crates.io-index" 845 + checksum = "bfc1c836fdc3d1ef87c348b237b5b5c4dff922156fb2d968f57734f9669768ca" 846 + dependencies = [ 847 + "proc-macro2 0.4.30", 848 + "quote 0.6.13", 849 + "syn 0.15.44", 850 + "version_check 0.9.2", 851 + "yansi", 852 + ] 853 + 854 + [[package]] 855 + name = "percent-encoding" 856 + version = "1.0.1" 857 + source = "registry+https://github.com/rust-lang/crates.io-index" 858 + checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" 859 + 860 + [[package]] 861 + name = "percent-encoding" 862 + version = "2.1.0" 863 + source = "registry+https://github.com/rust-lang/crates.io-index" 864 + checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" 865 + 866 + [[package]] 867 + name = "pin-project" 868 + version = "0.4.23" 869 + source = "registry+https://github.com/rust-lang/crates.io-index" 870 + checksum = "ca4433fff2ae79342e497d9f8ee990d174071408f28f726d6d83af93e58e48aa" 871 + dependencies = [ 872 + "pin-project-internal", 873 + ] 874 + 875 + [[package]] 876 + name = "pin-project-internal" 877 + version = "0.4.23" 878 + source = "registry+https://github.com/rust-lang/crates.io-index" 879 + checksum = "2c0e815c3ee9a031fdf5af21c10aa17c573c9c6a566328d99e3936c34e36461f" 880 + dependencies = [ 881 + "proc-macro2 1.0.21", 882 + "quote 1.0.7", 883 + "syn 1.0.41", 884 + ] 885 + 886 + [[package]] 887 + name = "pin-project-lite" 888 + version = "0.1.7" 889 + source = "registry+https://github.com/rust-lang/crates.io-index" 890 + checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715" 891 + 892 + [[package]] 893 + name = "pin-utils" 894 + version = "0.1.0" 895 + source = "registry+https://github.com/rust-lang/crates.io-index" 896 + checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 897 + 898 + [[package]] 899 + name = "pkg-config" 900 + version = "0.3.18" 901 + source = "registry+https://github.com/rust-lang/crates.io-index" 902 + checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33" 903 + 904 + [[package]] 905 + name = "polyval" 906 + version = "0.3.3" 907 + source = "registry+https://github.com/rust-lang/crates.io-index" 908 + checksum = "7ec3341498978de3bfd12d1b22f1af1de22818f5473a11e8a6ef997989e3a212" 909 + dependencies = [ 910 + "cfg-if", 911 + "universal-hash", 912 + ] 913 + 914 + [[package]] 915 + name = "ppv-lite86" 916 + version = "0.2.9" 917 + source = "registry+https://github.com/rust-lang/crates.io-index" 918 + checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" 919 + 920 + [[package]] 921 + name = "proc-macro2" 922 + version = "0.4.30" 923 + source = "registry+https://github.com/rust-lang/crates.io-index" 924 + checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" 925 + dependencies = [ 926 + "unicode-xid 0.1.0", 927 + ] 928 + 929 + [[package]] 930 + name = "proc-macro2" 931 + version = "1.0.21" 932 + source = "registry+https://github.com/rust-lang/crates.io-index" 933 + checksum = "36e28516df94f3dd551a587da5357459d9b36d945a7c37c3557928c1c2ff2a2c" 934 + dependencies = [ 935 + "unicode-xid 0.2.1", 936 + ] 937 + 938 + [[package]] 939 + name = "quote" 940 + version = "0.6.13" 941 + source = "registry+https://github.com/rust-lang/crates.io-index" 942 + checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" 943 + dependencies = [ 944 + "proc-macro2 0.4.30", 945 + ] 946 + 947 + [[package]] 948 + name = "quote" 949 + version = "1.0.7" 950 + source = "registry+https://github.com/rust-lang/crates.io-index" 951 + checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" 952 + dependencies = [ 953 + "proc-macro2 1.0.21", 954 + ] 955 + 956 + [[package]] 957 + name = "rand" 958 + version = "0.7.3" 959 + source = "registry+https://github.com/rust-lang/crates.io-index" 960 + checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" 961 + dependencies = [ 962 + "getrandom", 963 + "libc", 964 + "rand_chacha", 965 + "rand_core", 966 + "rand_hc", 967 + ] 968 + 969 + [[package]] 970 + name = "rand_chacha" 971 + version = "0.2.2" 972 + source = "registry+https://github.com/rust-lang/crates.io-index" 973 + checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" 974 + dependencies = [ 975 + "ppv-lite86", 976 + "rand_core", 977 + ] 978 + 979 + [[package]] 980 + name = "rand_core" 981 + version = "0.5.1" 982 + source = "registry+https://github.com/rust-lang/crates.io-index" 983 + checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" 984 + dependencies = [ 985 + "getrandom", 986 + ] 987 + 988 + [[package]] 989 + name = "rand_hc" 990 + version = "0.2.0" 991 + source = "registry+https://github.com/rust-lang/crates.io-index" 992 + checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" 993 + dependencies = [ 994 + "rand_core", 995 + ] 996 + 997 + [[package]] 998 + name = "redox_syscall" 999 + version = "0.1.57" 1000 + source = "registry+https://github.com/rust-lang/crates.io-index" 1001 + checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" 1002 + 1003 + [[package]] 1004 + name = "remove_dir_all" 1005 + version = "0.5.3" 1006 + source = "registry+https://github.com/rust-lang/crates.io-index" 1007 + checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" 1008 + dependencies = [ 1009 + "winapi 0.3.9", 1010 + ] 1011 + 1012 + [[package]] 1013 + name = "reqwest" 1014 + version = "0.10.8" 1015 + source = "registry+https://github.com/rust-lang/crates.io-index" 1016 + checksum = "e9eaa17ac5d7b838b7503d118fa16ad88f440498bf9ffe5424e621f93190d61e" 1017 + dependencies = [ 1018 + "base64 0.12.3", 1019 + "bytes", 1020 + "encoding_rs", 1021 + "futures-core", 1022 + "futures-util", 1023 + "http", 1024 + "http-body", 1025 + "hyper 0.13.8", 1026 + "hyper-tls", 1027 + "ipnet", 1028 + "js-sys", 1029 + "lazy_static", 1030 + "log 0.4.11", 1031 + "mime 0.3.16", 1032 + "mime_guess", 1033 + "native-tls", 1034 + "percent-encoding 2.1.0", 1035 + "pin-project-lite", 1036 + "serde", 1037 + "serde_json", 1038 + "serde_urlencoded", 1039 + "tokio", 1040 + "tokio-tls", 1041 + "url 2.1.1", 1042 + "wasm-bindgen", 1043 + "wasm-bindgen-futures", 1044 + "web-sys", 1045 + "winreg", 1046 + ] 1047 + 1048 + [[package]] 1049 + name = "rocket" 1050 + version = "0.4.5" 1051 + source = "registry+https://github.com/rust-lang/crates.io-index" 1052 + checksum = "6130967b369cfb8411b0b73e96fcba1229c32a9cc6f295d144f879bfced13c6e" 1053 + dependencies = [ 1054 + "atty", 1055 + "base64 0.12.3", 1056 + "log 0.4.11", 1057 + "memchr", 1058 + "num_cpus", 1059 + "pear", 1060 + "rocket_codegen", 1061 + "rocket_http", 1062 + "state", 1063 + "time", 1064 + "toml", 1065 + "version_check 0.9.2", 1066 + "yansi", 1067 + ] 1068 + 1069 + [[package]] 1070 + name = "rocket_codegen" 1071 + version = "0.4.5" 1072 + source = "registry+https://github.com/rust-lang/crates.io-index" 1073 + checksum = "cb852e6da168fb948a8f2b798ba2e2f0e4fc860eae0efa9cf2bf0f5466bb0425" 1074 + dependencies = [ 1075 + "devise", 1076 + "glob", 1077 + "indexmap", 1078 + "quote 0.6.13", 1079 + "rocket_http", 1080 + "version_check 0.9.2", 1081 + "yansi", 1082 + ] 1083 + 1084 + [[package]] 1085 + name = "rocket_http" 1086 + version = "0.4.5" 1087 + source = "registry+https://github.com/rust-lang/crates.io-index" 1088 + checksum = "1aff5a5480175f2f553a876b251e9350c74196128806d176da3a51c82aab5428" 1089 + dependencies = [ 1090 + "cookie", 1091 + "hyper 0.10.16", 1092 + "indexmap", 1093 + "pear", 1094 + "percent-encoding 1.0.1", 1095 + "smallvec", 1096 + "state", 1097 + "time", 1098 + "unicode-xid 0.1.0", 1099 + ] 1100 + 1101 + [[package]] 1102 + name = "ryu" 1103 + version = "1.0.5" 1104 + source = "registry+https://github.com/rust-lang/crates.io-index" 1105 + checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" 1106 + 1107 + [[package]] 1108 + name = "safemem" 1109 + version = "0.3.3" 1110 + source = "registry+https://github.com/rust-lang/crates.io-index" 1111 + checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" 1112 + 1113 + [[package]] 1114 + name = "schannel" 1115 + version = "0.1.19" 1116 + source = "registry+https://github.com/rust-lang/crates.io-index" 1117 + checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" 1118 + dependencies = [ 1119 + "lazy_static", 1120 + "winapi 0.3.9", 1121 + ] 1122 + 1123 + [[package]] 1124 + name = "security-framework" 1125 + version = "0.4.4" 1126 + source = "registry+https://github.com/rust-lang/crates.io-index" 1127 + checksum = "64808902d7d99f78eaddd2b4e2509713babc3dc3c85ad6f4c447680f3c01e535" 1128 + dependencies = [ 1129 + "bitflags", 1130 + "core-foundation", 1131 + "core-foundation-sys", 1132 + "libc", 1133 + "security-framework-sys", 1134 + ] 1135 + 1136 + [[package]] 1137 + name = "security-framework-sys" 1138 + version = "0.4.3" 1139 + source = "registry+https://github.com/rust-lang/crates.io-index" 1140 + checksum = "17bf11d99252f512695eb468de5516e5cf75455521e69dfe343f3b74e4748405" 1141 + dependencies = [ 1142 + "core-foundation-sys", 1143 + "libc", 1144 + ] 1145 + 1146 + [[package]] 1147 + name = "serde" 1148 + version = "1.0.116" 1149 + source = "registry+https://github.com/rust-lang/crates.io-index" 1150 + checksum = "96fe57af81d28386a513cbc6858332abc6117cfdb5999647c6444b8f43a370a5" 1151 + 1152 + [[package]] 1153 + name = "serde_json" 1154 + version = "1.0.57" 1155 + source = "registry+https://github.com/rust-lang/crates.io-index" 1156 + checksum = "164eacbdb13512ec2745fb09d51fd5b22b0d65ed294a1dcf7285a360c80a675c" 1157 + dependencies = [ 1158 + "itoa", 1159 + "ryu", 1160 + "serde", 1161 + ] 1162 + 1163 + [[package]] 1164 + name = "serde_urlencoded" 1165 + version = "0.6.1" 1166 + source = "registry+https://github.com/rust-lang/crates.io-index" 1167 + checksum = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" 1168 + dependencies = [ 1169 + "dtoa", 1170 + "itoa", 1171 + "serde", 1172 + "url 2.1.1", 1173 + ] 1174 + 1175 + [[package]] 1176 + name = "sha2" 1177 + version = "0.8.2" 1178 + source = "registry+https://github.com/rust-lang/crates.io-index" 1179 + checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" 1180 + dependencies = [ 1181 + "block-buffer", 1182 + "digest", 1183 + "fake-simd", 1184 + "opaque-debug", 1185 + ] 1186 + 1187 + [[package]] 1188 + name = "signal-hook-registry" 1189 + version = "1.2.1" 1190 + source = "registry+https://github.com/rust-lang/crates.io-index" 1191 + checksum = "a3e12110bc539e657a646068aaf5eb5b63af9d0c1f7b29c97113fad80e15f035" 1192 + dependencies = [ 1193 + "arc-swap", 1194 + "libc", 1195 + ] 1196 + 1197 + [[package]] 1198 + name = "slab" 1199 + version = "0.4.2" 1200 + source = "registry+https://github.com/rust-lang/crates.io-index" 1201 + checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" 1202 + 1203 + [[package]] 1204 + name = "smallvec" 1205 + version = "1.4.2" 1206 + source = "registry+https://github.com/rust-lang/crates.io-index" 1207 + checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" 1208 + 1209 + [[package]] 1210 + name = "socket2" 1211 + version = "0.3.15" 1212 + source = "registry+https://github.com/rust-lang/crates.io-index" 1213 + checksum = "b1fa70dc5c8104ec096f4fe7ede7a221d35ae13dcd19ba1ad9a81d2cab9a1c44" 1214 + dependencies = [ 1215 + "cfg-if", 1216 + "libc", 1217 + "redox_syscall", 1218 + "winapi 0.3.9", 1219 + ] 1220 + 1221 + [[package]] 1222 + name = "state" 1223 + version = "0.4.1" 1224 + source = "registry+https://github.com/rust-lang/crates.io-index" 1225 + checksum = "7345c971d1ef21ffdbd103a75990a15eb03604fc8b8852ca8cb418ee1a099028" 1226 + 1227 + [[package]] 1228 + name = "subtle" 1229 + version = "1.0.0" 1230 + source = "registry+https://github.com/rust-lang/crates.io-index" 1231 + checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" 1232 + 1233 + [[package]] 1234 + name = "subtle" 1235 + version = "2.3.0" 1236 + source = "registry+https://github.com/rust-lang/crates.io-index" 1237 + checksum = "343f3f510c2915908f155e94f17220b19ccfacf2a64a2a5d8004f2c3e311e7fd" 1238 + 1239 + [[package]] 1240 + name = "syn" 1241 + version = "0.15.44" 1242 + source = "registry+https://github.com/rust-lang/crates.io-index" 1243 + checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" 1244 + dependencies = [ 1245 + "proc-macro2 0.4.30", 1246 + "quote 0.6.13", 1247 + "unicode-xid 0.1.0", 1248 + ] 1249 + 1250 + [[package]] 1251 + name = "syn" 1252 + version = "1.0.41" 1253 + source = "registry+https://github.com/rust-lang/crates.io-index" 1254 + checksum = "6690e3e9f692504b941dc6c3b188fd28df054f7fb8469ab40680df52fdcc842b" 1255 + dependencies = [ 1256 + "proc-macro2 1.0.21", 1257 + "quote 1.0.7", 1258 + "unicode-xid 0.2.1", 1259 + ] 1260 + 1261 + [[package]] 1262 + name = "tempfile" 1263 + version = "3.1.0" 1264 + source = "registry+https://github.com/rust-lang/crates.io-index" 1265 + checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" 1266 + dependencies = [ 1267 + "cfg-if", 1268 + "libc", 1269 + "rand", 1270 + "redox_syscall", 1271 + "remove_dir_all", 1272 + "winapi 0.3.9", 1273 + ] 1274 + 1275 + [[package]] 1276 + name = "time" 1277 + version = "0.1.44" 1278 + source = "registry+https://github.com/rust-lang/crates.io-index" 1279 + checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" 1280 + dependencies = [ 1281 + "libc", 1282 + "wasi 0.10.0+wasi-snapshot-preview1", 1283 + "winapi 0.3.9", 1284 + ] 1285 + 1286 + [[package]] 1287 + name = "tinyvec" 1288 + version = "0.3.4" 1289 + source = "registry+https://github.com/rust-lang/crates.io-index" 1290 + checksum = "238ce071d267c5710f9d31451efec16c5ee22de34df17cc05e56cbc92e967117" 1291 + 1292 + [[package]] 1293 + name = "tokio" 1294 + version = "0.2.22" 1295 + source = "registry+https://github.com/rust-lang/crates.io-index" 1296 + checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd" 1297 + dependencies = [ 1298 + "bytes", 1299 + "fnv", 1300 + "futures-core", 1301 + "iovec", 1302 + "lazy_static", 1303 + "libc", 1304 + "memchr", 1305 + "mio", 1306 + "mio-named-pipes", 1307 + "mio-uds", 1308 + "num_cpus", 1309 + "pin-project-lite", 1310 + "signal-hook-registry", 1311 + "slab", 1312 + "tokio-macros", 1313 + "winapi 0.3.9", 1314 + ] 1315 + 1316 + [[package]] 1317 + name = "tokio-macros" 1318 + version = "0.2.5" 1319 + source = "registry+https://github.com/rust-lang/crates.io-index" 1320 + checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" 1321 + dependencies = [ 1322 + "proc-macro2 1.0.21", 1323 + "quote 1.0.7", 1324 + "syn 1.0.41", 1325 + ] 1326 + 1327 + [[package]] 1328 + name = "tokio-tls" 1329 + version = "0.3.1" 1330 + source = "registry+https://github.com/rust-lang/crates.io-index" 1331 + checksum = "9a70f4fcd7b3b24fb194f837560168208f669ca8cb70d0c4b862944452396343" 1332 + dependencies = [ 1333 + "native-tls", 1334 + "tokio", 1335 + ] 1336 + 1337 + [[package]] 1338 + name = "tokio-util" 1339 + version = "0.3.1" 1340 + source = "registry+https://github.com/rust-lang/crates.io-index" 1341 + checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" 1342 + dependencies = [ 1343 + "bytes", 1344 + "futures-core", 1345 + "futures-sink", 1346 + "log 0.4.11", 1347 + "pin-project-lite", 1348 + "tokio", 1349 + ] 1350 + 1351 + [[package]] 1352 + name = "toml" 1353 + version = "0.4.10" 1354 + source = "registry+https://github.com/rust-lang/crates.io-index" 1355 + checksum = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" 1356 + dependencies = [ 1357 + "serde", 1358 + ] 1359 + 1360 + [[package]] 1361 + name = "tower-service" 1362 + version = "0.3.0" 1363 + source = "registry+https://github.com/rust-lang/crates.io-index" 1364 + checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" 1365 + 1366 + [[package]] 1367 + name = "tracing" 1368 + version = "0.1.19" 1369 + source = "registry+https://github.com/rust-lang/crates.io-index" 1370 + checksum = "6d79ca061b032d6ce30c660fded31189ca0b9922bf483cd70759f13a2d86786c" 1371 + dependencies = [ 1372 + "cfg-if", 1373 + "log 0.4.11", 1374 + "tracing-core", 1375 + ] 1376 + 1377 + [[package]] 1378 + name = "tracing-core" 1379 + version = "0.1.16" 1380 + source = "registry+https://github.com/rust-lang/crates.io-index" 1381 + checksum = "5bcf46c1f1f06aeea2d6b81f3c863d0930a596c86ad1920d4e5bad6dd1d7119a" 1382 + dependencies = [ 1383 + "lazy_static", 1384 + ] 1385 + 1386 + [[package]] 1387 + name = "traitobject" 1388 + version = "0.1.0" 1389 + source = "registry+https://github.com/rust-lang/crates.io-index" 1390 + checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" 1391 + 1392 + [[package]] 1393 + name = "try-lock" 1394 + version = "0.2.3" 1395 + source = "registry+https://github.com/rust-lang/crates.io-index" 1396 + checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" 1397 + 1398 + [[package]] 1399 + name = "typeable" 1400 + version = "0.1.2" 1401 + source = "registry+https://github.com/rust-lang/crates.io-index" 1402 + checksum = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" 1403 + 1404 + [[package]] 1405 + name = "typenum" 1406 + version = "1.12.0" 1407 + source = "registry+https://github.com/rust-lang/crates.io-index" 1408 + checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" 1409 + 1410 + [[package]] 1411 + name = "unicase" 1412 + version = "1.4.2" 1413 + source = "registry+https://github.com/rust-lang/crates.io-index" 1414 + checksum = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" 1415 + dependencies = [ 1416 + "version_check 0.1.5", 1417 + ] 1418 + 1419 + [[package]] 1420 + name = "unicase" 1421 + version = "2.6.0" 1422 + source = "registry+https://github.com/rust-lang/crates.io-index" 1423 + checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" 1424 + dependencies = [ 1425 + "version_check 0.9.2", 1426 + ] 1427 + 1428 + [[package]] 1429 + name = "unicode-bidi" 1430 + version = "0.3.4" 1431 + source = "registry+https://github.com/rust-lang/crates.io-index" 1432 + checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" 1433 + dependencies = [ 1434 + "matches", 1435 + ] 1436 + 1437 + [[package]] 1438 + name = "unicode-normalization" 1439 + version = "0.1.13" 1440 + source = "registry+https://github.com/rust-lang/crates.io-index" 1441 + checksum = "6fb19cf769fa8c6a80a162df694621ebeb4dafb606470b2b2fce0be40a98a977" 1442 + dependencies = [ 1443 + "tinyvec", 1444 + ] 1445 + 1446 + [[package]] 1447 + name = "unicode-xid" 1448 + version = "0.1.0" 1449 + source = "registry+https://github.com/rust-lang/crates.io-index" 1450 + checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" 1451 + 1452 + [[package]] 1453 + name = "unicode-xid" 1454 + version = "0.2.1" 1455 + source = "registry+https://github.com/rust-lang/crates.io-index" 1456 + checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" 1457 + 1458 + [[package]] 1459 + name = "universal-hash" 1460 + version = "0.3.0" 1461 + source = "registry+https://github.com/rust-lang/crates.io-index" 1462 + checksum = "df0c900f2f9b4116803415878ff48b63da9edb268668e08cf9292d7503114a01" 1463 + dependencies = [ 1464 + "generic-array", 1465 + "subtle 2.3.0", 1466 + ] 1467 + 1468 + [[package]] 1469 + name = "url" 1470 + version = "1.7.2" 1471 + source = "registry+https://github.com/rust-lang/crates.io-index" 1472 + checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" 1473 + dependencies = [ 1474 + "idna 0.1.5", 1475 + "matches", 1476 + "percent-encoding 1.0.1", 1477 + ] 1478 + 1479 + [[package]] 1480 + name = "url" 1481 + version = "2.1.1" 1482 + source = "registry+https://github.com/rust-lang/crates.io-index" 1483 + checksum = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" 1484 + dependencies = [ 1485 + "idna 0.2.0", 1486 + "matches", 1487 + "percent-encoding 2.1.0", 1488 + ] 1489 + 1490 + [[package]] 1491 + name = "vcpkg" 1492 + version = "0.2.10" 1493 + source = "registry+https://github.com/rust-lang/crates.io-index" 1494 + checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c" 1495 + 1496 + [[package]] 1497 + name = "version_check" 1498 + version = "0.1.5" 1499 + source = "registry+https://github.com/rust-lang/crates.io-index" 1500 + checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" 1501 + 1502 + [[package]] 1503 + name = "version_check" 1504 + version = "0.9.2" 1505 + source = "registry+https://github.com/rust-lang/crates.io-index" 1506 + checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" 1507 + 1508 + [[package]] 1509 + name = "want" 1510 + version = "0.3.0" 1511 + source = "registry+https://github.com/rust-lang/crates.io-index" 1512 + checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" 1513 + dependencies = [ 1514 + "log 0.4.11", 1515 + "try-lock", 1516 + ] 1517 + 1518 + [[package]] 1519 + name = "wasi" 1520 + version = "0.9.0+wasi-snapshot-preview1" 1521 + source = "registry+https://github.com/rust-lang/crates.io-index" 1522 + checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" 1523 + 1524 + [[package]] 1525 + name = "wasi" 1526 + version = "0.10.0+wasi-snapshot-preview1" 1527 + source = "registry+https://github.com/rust-lang/crates.io-index" 1528 + checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" 1529 + 1530 + [[package]] 1531 + name = "wasm-bindgen" 1532 + version = "0.2.68" 1533 + source = "registry+https://github.com/rust-lang/crates.io-index" 1534 + checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" 1535 + dependencies = [ 1536 + "cfg-if", 1537 + "serde", 1538 + "serde_json", 1539 + "wasm-bindgen-macro", 1540 + ] 1541 + 1542 + [[package]] 1543 + name = "wasm-bindgen-backend" 1544 + version = "0.2.68" 1545 + source = "registry+https://github.com/rust-lang/crates.io-index" 1546 + checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" 1547 + dependencies = [ 1548 + "bumpalo", 1549 + "lazy_static", 1550 + "log 0.4.11", 1551 + "proc-macro2 1.0.21", 1552 + "quote 1.0.7", 1553 + "syn 1.0.41", 1554 + "wasm-bindgen-shared", 1555 + ] 1556 + 1557 + [[package]] 1558 + name = "wasm-bindgen-futures" 1559 + version = "0.4.18" 1560 + source = "registry+https://github.com/rust-lang/crates.io-index" 1561 + checksum = "b7866cab0aa01de1edf8b5d7936938a7e397ee50ce24119aef3e1eaa3b6171da" 1562 + dependencies = [ 1563 + "cfg-if", 1564 + "js-sys", 1565 + "wasm-bindgen", 1566 + "web-sys", 1567 + ] 1568 + 1569 + [[package]] 1570 + name = "wasm-bindgen-macro" 1571 + version = "0.2.68" 1572 + source = "registry+https://github.com/rust-lang/crates.io-index" 1573 + checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" 1574 + dependencies = [ 1575 + "quote 1.0.7", 1576 + "wasm-bindgen-macro-support", 1577 + ] 1578 + 1579 + [[package]] 1580 + name = "wasm-bindgen-macro-support" 1581 + version = "0.2.68" 1582 + source = "registry+https://github.com/rust-lang/crates.io-index" 1583 + checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" 1584 + dependencies = [ 1585 + "proc-macro2 1.0.21", 1586 + "quote 1.0.7", 1587 + "syn 1.0.41", 1588 + "wasm-bindgen-backend", 1589 + "wasm-bindgen-shared", 1590 + ] 1591 + 1592 + [[package]] 1593 + name = "wasm-bindgen-shared" 1594 + version = "0.2.68" 1595 + source = "registry+https://github.com/rust-lang/crates.io-index" 1596 + checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" 1597 + 1598 + [[package]] 1599 + name = "weather-rust-service" 1600 + version = "0.1.0" 1601 + dependencies = [ 1602 + "reqwest", 1603 + "rocket", 1604 + "serde_json", 1605 + "tokio", 1606 + ] 1607 + 1608 + [[package]] 1609 + name = "web-sys" 1610 + version = "0.3.45" 1611 + source = "registry+https://github.com/rust-lang/crates.io-index" 1612 + checksum = "4bf6ef87ad7ae8008e15a355ce696bed26012b7caa21605188cfd8214ab51e2d" 1613 + dependencies = [ 1614 + "js-sys", 1615 + "wasm-bindgen", 1616 + ] 1617 + 1618 + [[package]] 1619 + name = "winapi" 1620 + version = "0.2.8" 1621 + source = "registry+https://github.com/rust-lang/crates.io-index" 1622 + checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" 1623 + 1624 + [[package]] 1625 + name = "winapi" 1626 + version = "0.3.9" 1627 + source = "registry+https://github.com/rust-lang/crates.io-index" 1628 + checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1629 + dependencies = [ 1630 + "winapi-i686-pc-windows-gnu", 1631 + "winapi-x86_64-pc-windows-gnu", 1632 + ] 1633 + 1634 + [[package]] 1635 + name = "winapi-build" 1636 + version = "0.1.1" 1637 + source = "registry+https://github.com/rust-lang/crates.io-index" 1638 + checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" 1639 + 1640 + [[package]] 1641 + name = "winapi-i686-pc-windows-gnu" 1642 + version = "0.4.0" 1643 + source = "registry+https://github.com/rust-lang/crates.io-index" 1644 + checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1645 + 1646 + [[package]] 1647 + name = "winapi-x86_64-pc-windows-gnu" 1648 + version = "0.4.0" 1649 + source = "registry+https://github.com/rust-lang/crates.io-index" 1650 + checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1651 + 1652 + [[package]] 1653 + name = "winreg" 1654 + version = "0.7.0" 1655 + source = "registry+https://github.com/rust-lang/crates.io-index" 1656 + checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" 1657 + dependencies = [ 1658 + "winapi 0.3.9", 1659 + ] 1660 + 1661 + [[package]] 1662 + name = "ws2_32-sys" 1663 + version = "0.2.1" 1664 + source = "registry+https://github.com/rust-lang/crates.io-index" 1665 + checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" 1666 + dependencies = [ 1667 + "winapi 0.2.8", 1668 + "winapi-build", 1669 + ] 1670 + 1671 + [[package]] 1672 + name = "yansi" 1673 + version = "0.5.0" 1674 + source = "registry+https://github.com/rust-lang/crates.io-index" 1675 + checksum = "9fc79f4a1e39857fc00c3f662cbf2651c771f00e9c15fe2abc341806bd46bd71" 1676 + 1677 + [[package]] 1678 + name = "zeroize" 1679 + version = "1.1.1" 1680 + source = "registry+https://github.com/rust-lang/crates.io-index" 1681 + checksum = "05f33972566adbd2d3588b0491eb94b98b43695c4ef897903470ede4f3f5a28a"
+14
Cargo.toml
··· 1 + [package] 2 + name = "weather-rust-service" 3 + version = "0.1.0" 4 + authors = ["vylion <volfaria@gmail.com>"] 5 + edition = "2018" 6 + 7 + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 + 9 + [dependencies] 10 + serde_json = "1.0.57" 11 + # serde = { version = "1.0", features = ["derive"] } 12 + reqwest = { version="0.10.8", features=["json", "blocking"] } 13 + tokio = { version="0.2.22", features=["full"] } 14 + rocket = "0.4.5"
+16
src/README.md
··· 1 + # Notes 2 + 3 + As for REST API enabling libraries, the one with the most readily available information was Rocket, and that was the main reason Rocket was chosen for this app. However, it requires the `nightly` verison of Rust and, currently, it has no capabilities for asynchronous functions to work as REST handlers, which is why the `CLient` created in `download.rs` is `blocking` instead of asynchronous. 4 + 5 + Ideas for improvement: 6 + 7 + * Adding actual testing. 8 + * Check that parameters are compatible (city name with the country code, for example). 9 + * Adding some permanence, so requests closer in time than 10 minutes use the local cache copy. 10 + * Adding the alternative API calls available at OpenWeather. 11 + 12 + # Consulted Documentation 13 + 14 + * [Rust crash course](https://www.youtube.com/watch?v=zF34dRivLOw), [Learn Rust in Y minutes](https://learnxinyminutes.com/docs/rust/), some entries in the [Rust Programming Tutorials](https://www.youtube.com/playlist?list=PLVvjrrRCBy2JSHf9tGxGKJ-bYAN_uDCUL) list, and [How to build a command line app in Rust](https://www.youtube.com/watch?v=DQnLQznJK1Q). 15 + * Official docs for tokio, reqwest, rocket and the different serde utilities. 16 + * [Part 1](https://medium.com/swlh/demystifying-closures-futures-and-async-await-in-rust-part-1-closures-97e531e4dc50), [part 2](https://levelup.gitconnected.com/demystifying-closures-futures-and-async-await-in-rust-part-2-futures-abe95ab332a2) and [part 3](https://medium.com/@alistairisrael/demystifying-closures-futures-and-async-await-in-rust-part-3-async-await-9ed20eede7a4) of "Demystifying Closures, Futures, and async-await in Rust"
+108
src/download.rs
··· 1 + extern crate reqwest; 2 + 3 + use std::time::Duration; 4 + // use serde_json::Value; 5 + use crate::utils; 6 + 7 + /// Returns our own Http Client with a 10 sec timeout 8 + pub fn create_client() -> Option<reqwest::blocking::Client> { 9 + reqwest::blocking::Client::builder().timeout(Duration::from_secs(10)).build().ok() 10 + } 11 + 12 + /// Returns the default API call by city name with optional arguments concatenated into a String 13 + fn concat_url(api_id: String, 14 + query: utils::Query, 15 + city_name: String, 16 + state_code: Option<String>, 17 + country_code: Option<String>, 18 + unit: utils::Temp) -> String 19 + { 20 + // Patern matching the query type 21 + let query_type = match query 22 + { 23 + utils::Query::Weather => String::from("weather"), // Get current weather 24 + utils::Query::Forecast => String::from("forecast"), // Get forecast 25 + }; 26 + 27 + // Patern matching the state code 28 + let state_str = match state_code 29 + { 30 + None => String::new(), // Get an empty string if there's None 31 + Some(s) => format!(",{}", s) // Prefix a comma if there's Some 32 + }; 33 + 34 + // Patern matching the country code 35 + let country_str = match country_code 36 + { 37 + None => String::new(), // Get an empty string if there's None 38 + Some(s) => format!(",{}", s) // Prefix a comma if there's Some 39 + }; 40 + 41 + let temp_unit = match unit 42 + { 43 + utils::Temp::K => String::new(), 44 + utils::Temp::C => String::from("&units=metric"), 45 + utils::Temp::F => String::from("&units=imperial"), 46 + }; 47 + 48 + format!("http://api.openweathermap.org/data/2.5/{}?q={}{}{}&appid={}{}", 49 + &query_type, 50 + &city_name, 51 + &state_str, 52 + &country_str, 53 + &api_id, 54 + &temp_unit 55 + ) 56 + } 57 + 58 + /// Performs the API call and returns the JSON 59 + pub fn call_api(client: Option<reqwest::blocking::Client>, 60 + query_type: utils::Query, 61 + api_id: String, 62 + city_name: String, 63 + state_code: Option<String>, 64 + country_code: Option<String>, 65 + temp_unit: utils::Temp) -> Option<String> 66 + { 67 + // Patern matching the client argument 68 + let my_client = match client 69 + { 70 + None => { // if it's None, create a new one 71 + match create_client() 72 + { 73 + Some(c) => c, 74 + None => panic!("Couldn't create Http Client"), 75 + } 76 + }, 77 + Some(c) => c, // If it already has Some value, unwrap it 78 + }; 79 + 80 + let url = concat_url(api_id, query_type, city_name, state_code, country_code, temp_unit); 81 + let url = reqwest::Url::parse(&url).unwrap(); 82 + let req = my_client.get(url).send(); 83 + 84 + // Patern matching the request result 85 + match req 86 + { 87 + Err(_) => panic!("Couldn't get a response"), 88 + Ok(res) => { 89 + if let Ok(val) = res.text() // If there is a body 90 + { 91 + if !val.is_empty() 92 + { 93 + Some(val) 94 + } 95 + else 96 + { 97 + println!("Got an empty response body"); 98 + None 99 + } 100 + } 101 + else 102 + { 103 + println!("Got an empty/unparseable response"); 104 + None 105 + } 106 + }, 107 + } 108 + }
+55
src/main.rs
··· 1 + #![feature(proc_macro_hygiene, decl_macro)] 2 + 3 + #[macro_use] extern crate rocket; 4 + 5 + mod utils; 6 + mod download; 7 + 8 + #[get("/weather?<city>&<state>&<country>&<unit>")] 9 + fn weather(city: String, 10 + state: Option<String>, 11 + country: Option<String>, 12 + unit: Option<String>) -> String 13 + { 14 + let temp_unit = match unit { 15 + Some(s) if s == "c" || s == "C" => utils::Temp::C, 16 + Some(s) if s == "f" || s == "F" => utils::Temp::C, 17 + _ => utils::Temp::K, 18 + }; 19 + download::call_api(None, 20 + utils::Query::Weather, 21 + String::from("960c6bd08da0acfb2debc737573930c6"), 22 + city, 23 + state, 24 + country, 25 + temp_unit 26 + ).unwrap() 27 + } 28 + 29 + #[get("/forecast?<city>&<state>&<country>&<unit>")] 30 + fn forecast(city: String, 31 + state: Option<String>, 32 + country: Option<String>, 33 + unit: Option<String>) -> String 34 + { 35 + let temp_unit = match unit { 36 + Some(s) if s == "c" || s == "C" => utils::Temp::C, 37 + Some(s) if s == "f" || s == "F" => utils::Temp::C, 38 + _ => utils::Temp::K, 39 + }; 40 + download::call_api(None, 41 + utils::Query::Forecast, 42 + String::from("960c6bd08da0acfb2debc737573930c6"), 43 + city, 44 + state, 45 + country, 46 + temp_unit 47 + ).unwrap() 48 + } 49 + 50 + fn main() { 51 + rocket::ignite() 52 + .mount("/", routes![weather, forecast]) 53 + .launch(); 54 + 55 + }
+15
src/utils.rs
··· 1 + //use serde::{Deserialize, Serialize}; 2 + 3 + pub enum Temp 4 + { 5 + K, 6 + C, 7 + F 8 + } 9 + 10 + pub enum Query 11 + { 12 + Weather, 13 + Forecast 14 + } 15 +