├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── README.md └── src ├── main.rs ├── models.rs └── routes.rs /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "aead" 7 | version = "0.3.2" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" 10 | dependencies = [ 11 | "generic-array", 12 | ] 13 | 14 | [[package]] 15 | name = "aes" 16 | version = "0.6.0" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" 19 | dependencies = [ 20 | "aes-soft", 21 | "aesni", 22 | "cipher", 23 | ] 24 | 25 | [[package]] 26 | name = "aes-gcm" 27 | version = "0.8.0" 28 | source = "registry+https://github.com/rust-lang/crates.io-index" 29 | checksum = "5278b5fabbb9bd46e24aa69b2fdea62c99088e0a950a9be40e3e0101298f88da" 30 | dependencies = [ 31 | "aead", 32 | "aes", 33 | "cipher", 34 | "ctr", 35 | "ghash", 36 | "subtle", 37 | ] 38 | 39 | [[package]] 40 | name = "aes-soft" 41 | version = "0.6.4" 42 | source = "registry+https://github.com/rust-lang/crates.io-index" 43 | checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" 44 | dependencies = [ 45 | "cipher", 46 | "opaque-debug", 47 | ] 48 | 49 | [[package]] 50 | name = "aesni" 51 | version = "0.10.0" 52 | source = "registry+https://github.com/rust-lang/crates.io-index" 53 | checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" 54 | dependencies = [ 55 | "cipher", 56 | "opaque-debug", 57 | ] 58 | 59 | [[package]] 60 | name = "atty" 61 | version = "0.2.14" 62 | source = "registry+https://github.com/rust-lang/crates.io-index" 63 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 64 | dependencies = [ 65 | "hermit-abi", 66 | "libc", 67 | "winapi 0.3.9", 68 | ] 69 | 70 | [[package]] 71 | name = "autocfg" 72 | version = "1.0.1" 73 | source = "registry+https://github.com/rust-lang/crates.io-index" 74 | checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" 75 | 76 | [[package]] 77 | name = "base64" 78 | version = "0.9.3" 79 | source = "registry+https://github.com/rust-lang/crates.io-index" 80 | checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" 81 | dependencies = [ 82 | "byteorder", 83 | "safemem", 84 | ] 85 | 86 | [[package]] 87 | name = "base64" 88 | version = "0.12.3" 89 | source = "registry+https://github.com/rust-lang/crates.io-index" 90 | checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" 91 | 92 | [[package]] 93 | name = "base64" 94 | version = "0.13.0" 95 | source = "registry+https://github.com/rust-lang/crates.io-index" 96 | checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" 97 | 98 | [[package]] 99 | name = "bitflags" 100 | version = "1.2.1" 101 | source = "registry+https://github.com/rust-lang/crates.io-index" 102 | checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" 103 | 104 | [[package]] 105 | name = "block-buffer" 106 | version = "0.9.0" 107 | source = "registry+https://github.com/rust-lang/crates.io-index" 108 | checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" 109 | dependencies = [ 110 | "generic-array", 111 | ] 112 | 113 | [[package]] 114 | name = "byteorder" 115 | version = "1.4.2" 116 | source = "registry+https://github.com/rust-lang/crates.io-index" 117 | checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b" 118 | 119 | [[package]] 120 | name = "cfg-if" 121 | version = "0.1.10" 122 | source = "registry+https://github.com/rust-lang/crates.io-index" 123 | checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" 124 | 125 | [[package]] 126 | name = "cfg-if" 127 | version = "1.0.0" 128 | source = "registry+https://github.com/rust-lang/crates.io-index" 129 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 130 | 131 | [[package]] 132 | name = "cipher" 133 | version = "0.2.5" 134 | source = "registry+https://github.com/rust-lang/crates.io-index" 135 | checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" 136 | dependencies = [ 137 | "generic-array", 138 | ] 139 | 140 | [[package]] 141 | name = "cookie" 142 | version = "0.11.4" 143 | source = "registry+https://github.com/rust-lang/crates.io-index" 144 | checksum = "80f6044740a4a516b8aac14c140cdf35c1a640b1bd6b98b6224e49143b2f1566" 145 | dependencies = [ 146 | "aes-gcm", 147 | "base64 0.13.0", 148 | "hkdf", 149 | "hmac", 150 | "percent-encoding 2.1.0", 151 | "rand", 152 | "sha2", 153 | "time", 154 | ] 155 | 156 | [[package]] 157 | name = "cpuid-bool" 158 | version = "0.1.2" 159 | source = "registry+https://github.com/rust-lang/crates.io-index" 160 | checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" 161 | 162 | [[package]] 163 | name = "cpuid-bool" 164 | version = "0.2.0" 165 | source = "registry+https://github.com/rust-lang/crates.io-index" 166 | checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba" 167 | 168 | [[package]] 169 | name = "crypto-mac" 170 | version = "0.10.0" 171 | source = "registry+https://github.com/rust-lang/crates.io-index" 172 | checksum = "4857fd85a0c34b3c3297875b747c1e02e06b6a0ea32dd892d8192b9ce0813ea6" 173 | dependencies = [ 174 | "generic-array", 175 | "subtle", 176 | ] 177 | 178 | [[package]] 179 | name = "ctr" 180 | version = "0.6.0" 181 | source = "registry+https://github.com/rust-lang/crates.io-index" 182 | checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f" 183 | dependencies = [ 184 | "cipher", 185 | ] 186 | 187 | [[package]] 188 | name = "devise" 189 | version = "0.2.0" 190 | source = "registry+https://github.com/rust-lang/crates.io-index" 191 | checksum = "74e04ba2d03c5fa0d954c061fc8c9c288badadffc272ebb87679a89846de3ed3" 192 | dependencies = [ 193 | "devise_codegen", 194 | "devise_core", 195 | ] 196 | 197 | [[package]] 198 | name = "devise_codegen" 199 | version = "0.2.0" 200 | source = "registry+https://github.com/rust-lang/crates.io-index" 201 | checksum = "066ceb7928ca93a9bedc6d0e612a8a0424048b0ab1f75971b203d01420c055d7" 202 | dependencies = [ 203 | "devise_core", 204 | "quote 0.6.13", 205 | ] 206 | 207 | [[package]] 208 | name = "devise_core" 209 | version = "0.2.0" 210 | source = "registry+https://github.com/rust-lang/crates.io-index" 211 | checksum = "cf41c59b22b5e3ec0ea55c7847e5f358d340f3a8d6d53a5cf4f1564967f96487" 212 | dependencies = [ 213 | "bitflags", 214 | "proc-macro2 0.4.30", 215 | "quote 0.6.13", 216 | "syn 0.15.44", 217 | ] 218 | 219 | [[package]] 220 | name = "digest" 221 | version = "0.9.0" 222 | source = "registry+https://github.com/rust-lang/crates.io-index" 223 | checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" 224 | dependencies = [ 225 | "generic-array", 226 | ] 227 | 228 | [[package]] 229 | name = "filetime" 230 | version = "0.2.14" 231 | source = "registry+https://github.com/rust-lang/crates.io-index" 232 | checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" 233 | dependencies = [ 234 | "cfg-if 1.0.0", 235 | "libc", 236 | "redox_syscall", 237 | "winapi 0.3.9", 238 | ] 239 | 240 | [[package]] 241 | name = "fsevent" 242 | version = "0.4.0" 243 | source = "registry+https://github.com/rust-lang/crates.io-index" 244 | checksum = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6" 245 | dependencies = [ 246 | "bitflags", 247 | "fsevent-sys", 248 | ] 249 | 250 | [[package]] 251 | name = "fsevent-sys" 252 | version = "2.0.1" 253 | source = "registry+https://github.com/rust-lang/crates.io-index" 254 | checksum = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0" 255 | dependencies = [ 256 | "libc", 257 | ] 258 | 259 | [[package]] 260 | name = "fuchsia-zircon" 261 | version = "0.3.3" 262 | source = "registry+https://github.com/rust-lang/crates.io-index" 263 | checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" 264 | dependencies = [ 265 | "bitflags", 266 | "fuchsia-zircon-sys", 267 | ] 268 | 269 | [[package]] 270 | name = "fuchsia-zircon-sys" 271 | version = "0.3.3" 272 | source = "registry+https://github.com/rust-lang/crates.io-index" 273 | checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" 274 | 275 | [[package]] 276 | name = "generic-array" 277 | version = "0.14.4" 278 | source = "registry+https://github.com/rust-lang/crates.io-index" 279 | checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" 280 | dependencies = [ 281 | "typenum", 282 | "version_check 0.9.2", 283 | ] 284 | 285 | [[package]] 286 | name = "getrandom" 287 | version = "0.2.2" 288 | source = "registry+https://github.com/rust-lang/crates.io-index" 289 | checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" 290 | dependencies = [ 291 | "cfg-if 1.0.0", 292 | "libc", 293 | "wasi", 294 | ] 295 | 296 | [[package]] 297 | name = "ghash" 298 | version = "0.3.1" 299 | source = "registry+https://github.com/rust-lang/crates.io-index" 300 | checksum = "97304e4cd182c3846f7575ced3890c53012ce534ad9114046b0a9e00bb30a375" 301 | dependencies = [ 302 | "opaque-debug", 303 | "polyval", 304 | ] 305 | 306 | [[package]] 307 | name = "glob" 308 | version = "0.3.0" 309 | source = "registry+https://github.com/rust-lang/crates.io-index" 310 | checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" 311 | 312 | [[package]] 313 | name = "hashbrown" 314 | version = "0.9.1" 315 | source = "registry+https://github.com/rust-lang/crates.io-index" 316 | checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" 317 | 318 | [[package]] 319 | name = "hermit-abi" 320 | version = "0.1.18" 321 | source = "registry+https://github.com/rust-lang/crates.io-index" 322 | checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" 323 | dependencies = [ 324 | "libc", 325 | ] 326 | 327 | [[package]] 328 | name = "hkdf" 329 | version = "0.10.0" 330 | source = "registry+https://github.com/rust-lang/crates.io-index" 331 | checksum = "51ab2f639c231793c5f6114bdb9bbe50a7dbbfcd7c7c6bd8475dec2d991e964f" 332 | dependencies = [ 333 | "digest", 334 | "hmac", 335 | ] 336 | 337 | [[package]] 338 | name = "hmac" 339 | version = "0.10.1" 340 | source = "registry+https://github.com/rust-lang/crates.io-index" 341 | checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" 342 | dependencies = [ 343 | "crypto-mac", 344 | "digest", 345 | ] 346 | 347 | [[package]] 348 | name = "httparse" 349 | version = "1.3.5" 350 | source = "registry+https://github.com/rust-lang/crates.io-index" 351 | checksum = "615caabe2c3160b313d52ccc905335f4ed5f10881dd63dc5699d47e90be85691" 352 | 353 | [[package]] 354 | name = "hyper" 355 | version = "0.10.16" 356 | source = "registry+https://github.com/rust-lang/crates.io-index" 357 | checksum = "0a0652d9a2609a968c14be1a9ea00bf4b1d64e2e1f53a1b51b6fff3a6e829273" 358 | dependencies = [ 359 | "base64 0.9.3", 360 | "httparse", 361 | "language-tags", 362 | "log 0.3.9", 363 | "mime", 364 | "num_cpus", 365 | "time", 366 | "traitobject", 367 | "typeable", 368 | "unicase", 369 | "url", 370 | ] 371 | 372 | [[package]] 373 | name = "idna" 374 | version = "0.1.5" 375 | source = "registry+https://github.com/rust-lang/crates.io-index" 376 | checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" 377 | dependencies = [ 378 | "matches", 379 | "unicode-bidi", 380 | "unicode-normalization", 381 | ] 382 | 383 | [[package]] 384 | name = "indexmap" 385 | version = "1.6.1" 386 | source = "registry+https://github.com/rust-lang/crates.io-index" 387 | checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b" 388 | dependencies = [ 389 | "autocfg", 390 | "hashbrown", 391 | ] 392 | 393 | [[package]] 394 | name = "inotify" 395 | version = "0.7.1" 396 | source = "registry+https://github.com/rust-lang/crates.io-index" 397 | checksum = "4816c66d2c8ae673df83366c18341538f234a26d65a9ecea5c348b453ac1d02f" 398 | dependencies = [ 399 | "bitflags", 400 | "inotify-sys", 401 | "libc", 402 | ] 403 | 404 | [[package]] 405 | name = "inotify-sys" 406 | version = "0.1.5" 407 | source = "registry+https://github.com/rust-lang/crates.io-index" 408 | checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" 409 | dependencies = [ 410 | "libc", 411 | ] 412 | 413 | [[package]] 414 | name = "iovec" 415 | version = "0.1.4" 416 | source = "registry+https://github.com/rust-lang/crates.io-index" 417 | checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" 418 | dependencies = [ 419 | "libc", 420 | ] 421 | 422 | [[package]] 423 | name = "itoa" 424 | version = "0.4.7" 425 | source = "registry+https://github.com/rust-lang/crates.io-index" 426 | checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" 427 | 428 | [[package]] 429 | name = "kernel32-sys" 430 | version = "0.2.2" 431 | source = "registry+https://github.com/rust-lang/crates.io-index" 432 | checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" 433 | dependencies = [ 434 | "winapi 0.2.8", 435 | "winapi-build", 436 | ] 437 | 438 | [[package]] 439 | name = "language-tags" 440 | version = "0.2.2" 441 | source = "registry+https://github.com/rust-lang/crates.io-index" 442 | checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" 443 | 444 | [[package]] 445 | name = "lazycell" 446 | version = "1.3.0" 447 | source = "registry+https://github.com/rust-lang/crates.io-index" 448 | checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" 449 | 450 | [[package]] 451 | name = "libc" 452 | version = "0.2.87" 453 | source = "registry+https://github.com/rust-lang/crates.io-index" 454 | checksum = "265d751d31d6780a3f956bb5b8022feba2d94eeee5a84ba64f4212eedca42213" 455 | 456 | [[package]] 457 | name = "log" 458 | version = "0.3.9" 459 | source = "registry+https://github.com/rust-lang/crates.io-index" 460 | checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" 461 | dependencies = [ 462 | "log 0.4.14", 463 | ] 464 | 465 | [[package]] 466 | name = "log" 467 | version = "0.4.14" 468 | source = "registry+https://github.com/rust-lang/crates.io-index" 469 | checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" 470 | dependencies = [ 471 | "cfg-if 1.0.0", 472 | ] 473 | 474 | [[package]] 475 | name = "matches" 476 | version = "0.1.8" 477 | source = "registry+https://github.com/rust-lang/crates.io-index" 478 | checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" 479 | 480 | [[package]] 481 | name = "memchr" 482 | version = "2.3.4" 483 | source = "registry+https://github.com/rust-lang/crates.io-index" 484 | checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" 485 | 486 | [[package]] 487 | name = "mime" 488 | version = "0.2.6" 489 | source = "registry+https://github.com/rust-lang/crates.io-index" 490 | checksum = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" 491 | dependencies = [ 492 | "log 0.3.9", 493 | ] 494 | 495 | [[package]] 496 | name = "mio" 497 | version = "0.6.23" 498 | source = "registry+https://github.com/rust-lang/crates.io-index" 499 | checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" 500 | dependencies = [ 501 | "cfg-if 0.1.10", 502 | "fuchsia-zircon", 503 | "fuchsia-zircon-sys", 504 | "iovec", 505 | "kernel32-sys", 506 | "libc", 507 | "log 0.4.14", 508 | "miow", 509 | "net2", 510 | "slab", 511 | "winapi 0.2.8", 512 | ] 513 | 514 | [[package]] 515 | name = "mio-extras" 516 | version = "2.0.6" 517 | source = "registry+https://github.com/rust-lang/crates.io-index" 518 | checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" 519 | dependencies = [ 520 | "lazycell", 521 | "log 0.4.14", 522 | "mio", 523 | "slab", 524 | ] 525 | 526 | [[package]] 527 | name = "miow" 528 | version = "0.2.2" 529 | source = "registry+https://github.com/rust-lang/crates.io-index" 530 | checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" 531 | dependencies = [ 532 | "kernel32-sys", 533 | "net2", 534 | "winapi 0.2.8", 535 | "ws2_32-sys", 536 | ] 537 | 538 | [[package]] 539 | name = "net2" 540 | version = "0.2.37" 541 | source = "registry+https://github.com/rust-lang/crates.io-index" 542 | checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" 543 | dependencies = [ 544 | "cfg-if 0.1.10", 545 | "libc", 546 | "winapi 0.3.9", 547 | ] 548 | 549 | [[package]] 550 | name = "notify" 551 | version = "4.0.15" 552 | source = "registry+https://github.com/rust-lang/crates.io-index" 553 | checksum = "80ae4a7688d1fab81c5bf19c64fc8db920be8d519ce6336ed4e7efe024724dbd" 554 | dependencies = [ 555 | "bitflags", 556 | "filetime", 557 | "fsevent", 558 | "fsevent-sys", 559 | "inotify", 560 | "libc", 561 | "mio", 562 | "mio-extras", 563 | "walkdir", 564 | "winapi 0.3.9", 565 | ] 566 | 567 | [[package]] 568 | name = "num_cpus" 569 | version = "1.13.0" 570 | source = "registry+https://github.com/rust-lang/crates.io-index" 571 | checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" 572 | dependencies = [ 573 | "hermit-abi", 574 | "libc", 575 | ] 576 | 577 | [[package]] 578 | name = "opaque-debug" 579 | version = "0.3.0" 580 | source = "registry+https://github.com/rust-lang/crates.io-index" 581 | checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" 582 | 583 | [[package]] 584 | name = "pear" 585 | version = "0.1.4" 586 | source = "registry+https://github.com/rust-lang/crates.io-index" 587 | checksum = "5320f212db967792b67cfe12bd469d08afd6318a249bd917d5c19bc92200ab8a" 588 | dependencies = [ 589 | "pear_codegen", 590 | ] 591 | 592 | [[package]] 593 | name = "pear_codegen" 594 | version = "0.1.4" 595 | source = "registry+https://github.com/rust-lang/crates.io-index" 596 | checksum = "bfc1c836fdc3d1ef87c348b237b5b5c4dff922156fb2d968f57734f9669768ca" 597 | dependencies = [ 598 | "proc-macro2 0.4.30", 599 | "quote 0.6.13", 600 | "syn 0.15.44", 601 | "version_check 0.9.2", 602 | "yansi", 603 | ] 604 | 605 | [[package]] 606 | name = "percent-encoding" 607 | version = "1.0.1" 608 | source = "registry+https://github.com/rust-lang/crates.io-index" 609 | checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" 610 | 611 | [[package]] 612 | name = "percent-encoding" 613 | version = "2.1.0" 614 | source = "registry+https://github.com/rust-lang/crates.io-index" 615 | checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" 616 | 617 | [[package]] 618 | name = "polyval" 619 | version = "0.4.5" 620 | source = "registry+https://github.com/rust-lang/crates.io-index" 621 | checksum = "eebcc4aa140b9abd2bc40d9c3f7ccec842679cd79045ac3a7ac698c1a064b7cd" 622 | dependencies = [ 623 | "cpuid-bool 0.2.0", 624 | "opaque-debug", 625 | "universal-hash", 626 | ] 627 | 628 | [[package]] 629 | name = "ppv-lite86" 630 | version = "0.2.10" 631 | source = "registry+https://github.com/rust-lang/crates.io-index" 632 | checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" 633 | 634 | [[package]] 635 | name = "proc-macro2" 636 | version = "0.4.30" 637 | source = "registry+https://github.com/rust-lang/crates.io-index" 638 | checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" 639 | dependencies = [ 640 | "unicode-xid 0.1.0", 641 | ] 642 | 643 | [[package]] 644 | name = "proc-macro2" 645 | version = "1.0.24" 646 | source = "registry+https://github.com/rust-lang/crates.io-index" 647 | checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" 648 | dependencies = [ 649 | "unicode-xid 0.2.1", 650 | ] 651 | 652 | [[package]] 653 | name = "quote" 654 | version = "0.6.13" 655 | source = "registry+https://github.com/rust-lang/crates.io-index" 656 | checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" 657 | dependencies = [ 658 | "proc-macro2 0.4.30", 659 | ] 660 | 661 | [[package]] 662 | name = "quote" 663 | version = "1.0.9" 664 | source = "registry+https://github.com/rust-lang/crates.io-index" 665 | checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" 666 | dependencies = [ 667 | "proc-macro2 1.0.24", 668 | ] 669 | 670 | [[package]] 671 | name = "rand" 672 | version = "0.8.3" 673 | source = "registry+https://github.com/rust-lang/crates.io-index" 674 | checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" 675 | dependencies = [ 676 | "libc", 677 | "rand_chacha", 678 | "rand_core", 679 | "rand_hc", 680 | ] 681 | 682 | [[package]] 683 | name = "rand_chacha" 684 | version = "0.3.0" 685 | source = "registry+https://github.com/rust-lang/crates.io-index" 686 | checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" 687 | dependencies = [ 688 | "ppv-lite86", 689 | "rand_core", 690 | ] 691 | 692 | [[package]] 693 | name = "rand_core" 694 | version = "0.6.2" 695 | source = "registry+https://github.com/rust-lang/crates.io-index" 696 | checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" 697 | dependencies = [ 698 | "getrandom", 699 | ] 700 | 701 | [[package]] 702 | name = "rand_hc" 703 | version = "0.3.0" 704 | source = "registry+https://github.com/rust-lang/crates.io-index" 705 | checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" 706 | dependencies = [ 707 | "rand_core", 708 | ] 709 | 710 | [[package]] 711 | name = "redox_syscall" 712 | version = "0.2.5" 713 | source = "registry+https://github.com/rust-lang/crates.io-index" 714 | checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" 715 | dependencies = [ 716 | "bitflags", 717 | ] 718 | 719 | [[package]] 720 | name = "rocket" 721 | version = "0.4.7" 722 | source = "registry+https://github.com/rust-lang/crates.io-index" 723 | checksum = "7febfdfd4d43facfc7daba20349ebe2c310c6735bd6a2a9255ea8bc425b4cb13" 724 | dependencies = [ 725 | "atty", 726 | "base64 0.12.3", 727 | "log 0.4.14", 728 | "memchr", 729 | "num_cpus", 730 | "pear", 731 | "rocket_codegen", 732 | "rocket_http", 733 | "state", 734 | "time", 735 | "toml", 736 | "version_check 0.9.2", 737 | "yansi", 738 | ] 739 | 740 | [[package]] 741 | name = "rocket_codegen" 742 | version = "0.4.7" 743 | source = "registry+https://github.com/rust-lang/crates.io-index" 744 | checksum = "ceac2c55b2c8b1cdc53add64332defa5fc227f64263b86b4114d1386286d42a3" 745 | dependencies = [ 746 | "devise", 747 | "glob", 748 | "indexmap", 749 | "quote 0.6.13", 750 | "rocket_http", 751 | "version_check 0.9.2", 752 | "yansi", 753 | ] 754 | 755 | [[package]] 756 | name = "rocket_contrib" 757 | version = "0.4.7" 758 | source = "registry+https://github.com/rust-lang/crates.io-index" 759 | checksum = "d7954a707f9ca18aa74ca8c1f5d1f900f52a4dceb68e96e3112143f759cfd20e" 760 | dependencies = [ 761 | "log 0.4.14", 762 | "notify", 763 | "rocket", 764 | "serde", 765 | "serde_json", 766 | ] 767 | 768 | [[package]] 769 | name = "rocket_http" 770 | version = "0.4.7" 771 | source = "registry+https://github.com/rust-lang/crates.io-index" 772 | checksum = "ce364100ed7a1bf39257b69ebd014c1d5b4979b0d365d8c9ab0aa9c79645493d" 773 | dependencies = [ 774 | "cookie", 775 | "hyper", 776 | "indexmap", 777 | "pear", 778 | "percent-encoding 1.0.1", 779 | "smallvec", 780 | "state", 781 | "time", 782 | "unicode-xid 0.1.0", 783 | ] 784 | 785 | [[package]] 786 | name = "rust-rocket-webapi" 787 | version = "0.1.0" 788 | dependencies = [ 789 | "rocket", 790 | "rocket_contrib", 791 | "serde", 792 | "serde_json", 793 | ] 794 | 795 | [[package]] 796 | name = "ryu" 797 | version = "1.0.5" 798 | source = "registry+https://github.com/rust-lang/crates.io-index" 799 | checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" 800 | 801 | [[package]] 802 | name = "safemem" 803 | version = "0.3.3" 804 | source = "registry+https://github.com/rust-lang/crates.io-index" 805 | checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" 806 | 807 | [[package]] 808 | name = "same-file" 809 | version = "1.0.6" 810 | source = "registry+https://github.com/rust-lang/crates.io-index" 811 | checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" 812 | dependencies = [ 813 | "winapi-util", 814 | ] 815 | 816 | [[package]] 817 | name = "serde" 818 | version = "1.0.123" 819 | source = "registry+https://github.com/rust-lang/crates.io-index" 820 | checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae" 821 | dependencies = [ 822 | "serde_derive", 823 | ] 824 | 825 | [[package]] 826 | name = "serde_derive" 827 | version = "1.0.123" 828 | source = "registry+https://github.com/rust-lang/crates.io-index" 829 | checksum = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31" 830 | dependencies = [ 831 | "proc-macro2 1.0.24", 832 | "quote 1.0.9", 833 | "syn 1.0.60", 834 | ] 835 | 836 | [[package]] 837 | name = "serde_json" 838 | version = "1.0.64" 839 | source = "registry+https://github.com/rust-lang/crates.io-index" 840 | checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" 841 | dependencies = [ 842 | "itoa", 843 | "ryu", 844 | "serde", 845 | ] 846 | 847 | [[package]] 848 | name = "sha2" 849 | version = "0.9.3" 850 | source = "registry+https://github.com/rust-lang/crates.io-index" 851 | checksum = "fa827a14b29ab7f44778d14a88d3cb76e949c45083f7dbfa507d0cb699dc12de" 852 | dependencies = [ 853 | "block-buffer", 854 | "cfg-if 1.0.0", 855 | "cpuid-bool 0.1.2", 856 | "digest", 857 | "opaque-debug", 858 | ] 859 | 860 | [[package]] 861 | name = "slab" 862 | version = "0.4.2" 863 | source = "registry+https://github.com/rust-lang/crates.io-index" 864 | checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" 865 | 866 | [[package]] 867 | name = "smallvec" 868 | version = "1.6.1" 869 | source = "registry+https://github.com/rust-lang/crates.io-index" 870 | checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" 871 | 872 | [[package]] 873 | name = "state" 874 | version = "0.4.2" 875 | source = "registry+https://github.com/rust-lang/crates.io-index" 876 | checksum = "3015a7d0a5fd5105c91c3710d42f9ccf0abfb287d62206484dcc67f9569a6483" 877 | 878 | [[package]] 879 | name = "subtle" 880 | version = "2.4.0" 881 | source = "registry+https://github.com/rust-lang/crates.io-index" 882 | checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" 883 | 884 | [[package]] 885 | name = "syn" 886 | version = "0.15.44" 887 | source = "registry+https://github.com/rust-lang/crates.io-index" 888 | checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" 889 | dependencies = [ 890 | "proc-macro2 0.4.30", 891 | "quote 0.6.13", 892 | "unicode-xid 0.1.0", 893 | ] 894 | 895 | [[package]] 896 | name = "syn" 897 | version = "1.0.60" 898 | source = "registry+https://github.com/rust-lang/crates.io-index" 899 | checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" 900 | dependencies = [ 901 | "proc-macro2 1.0.24", 902 | "quote 1.0.9", 903 | "unicode-xid 0.2.1", 904 | ] 905 | 906 | [[package]] 907 | name = "time" 908 | version = "0.1.43" 909 | source = "registry+https://github.com/rust-lang/crates.io-index" 910 | checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" 911 | dependencies = [ 912 | "libc", 913 | "winapi 0.3.9", 914 | ] 915 | 916 | [[package]] 917 | name = "tinyvec" 918 | version = "1.1.1" 919 | source = "registry+https://github.com/rust-lang/crates.io-index" 920 | checksum = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023" 921 | dependencies = [ 922 | "tinyvec_macros", 923 | ] 924 | 925 | [[package]] 926 | name = "tinyvec_macros" 927 | version = "0.1.0" 928 | source = "registry+https://github.com/rust-lang/crates.io-index" 929 | checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" 930 | 931 | [[package]] 932 | name = "toml" 933 | version = "0.4.10" 934 | source = "registry+https://github.com/rust-lang/crates.io-index" 935 | checksum = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" 936 | dependencies = [ 937 | "serde", 938 | ] 939 | 940 | [[package]] 941 | name = "traitobject" 942 | version = "0.1.0" 943 | source = "registry+https://github.com/rust-lang/crates.io-index" 944 | checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" 945 | 946 | [[package]] 947 | name = "typeable" 948 | version = "0.1.2" 949 | source = "registry+https://github.com/rust-lang/crates.io-index" 950 | checksum = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" 951 | 952 | [[package]] 953 | name = "typenum" 954 | version = "1.12.0" 955 | source = "registry+https://github.com/rust-lang/crates.io-index" 956 | checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" 957 | 958 | [[package]] 959 | name = "unicase" 960 | version = "1.4.2" 961 | source = "registry+https://github.com/rust-lang/crates.io-index" 962 | checksum = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" 963 | dependencies = [ 964 | "version_check 0.1.5", 965 | ] 966 | 967 | [[package]] 968 | name = "unicode-bidi" 969 | version = "0.3.4" 970 | source = "registry+https://github.com/rust-lang/crates.io-index" 971 | checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" 972 | dependencies = [ 973 | "matches", 974 | ] 975 | 976 | [[package]] 977 | name = "unicode-normalization" 978 | version = "0.1.17" 979 | source = "registry+https://github.com/rust-lang/crates.io-index" 980 | checksum = "07fbfce1c8a97d547e8b5334978438d9d6ec8c20e38f56d4a4374d181493eaef" 981 | dependencies = [ 982 | "tinyvec", 983 | ] 984 | 985 | [[package]] 986 | name = "unicode-xid" 987 | version = "0.1.0" 988 | source = "registry+https://github.com/rust-lang/crates.io-index" 989 | checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" 990 | 991 | [[package]] 992 | name = "unicode-xid" 993 | version = "0.2.1" 994 | source = "registry+https://github.com/rust-lang/crates.io-index" 995 | checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" 996 | 997 | [[package]] 998 | name = "universal-hash" 999 | version = "0.4.0" 1000 | source = "registry+https://github.com/rust-lang/crates.io-index" 1001 | checksum = "8326b2c654932e3e4f9196e69d08fdf7cfd718e1dc6f66b347e6024a0c961402" 1002 | dependencies = [ 1003 | "generic-array", 1004 | "subtle", 1005 | ] 1006 | 1007 | [[package]] 1008 | name = "url" 1009 | version = "1.7.2" 1010 | source = "registry+https://github.com/rust-lang/crates.io-index" 1011 | checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" 1012 | dependencies = [ 1013 | "idna", 1014 | "matches", 1015 | "percent-encoding 1.0.1", 1016 | ] 1017 | 1018 | [[package]] 1019 | name = "version_check" 1020 | version = "0.1.5" 1021 | source = "registry+https://github.com/rust-lang/crates.io-index" 1022 | checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" 1023 | 1024 | [[package]] 1025 | name = "version_check" 1026 | version = "0.9.2" 1027 | source = "registry+https://github.com/rust-lang/crates.io-index" 1028 | checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" 1029 | 1030 | [[package]] 1031 | name = "walkdir" 1032 | version = "2.3.1" 1033 | source = "registry+https://github.com/rust-lang/crates.io-index" 1034 | checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" 1035 | dependencies = [ 1036 | "same-file", 1037 | "winapi 0.3.9", 1038 | "winapi-util", 1039 | ] 1040 | 1041 | [[package]] 1042 | name = "wasi" 1043 | version = "0.10.2+wasi-snapshot-preview1" 1044 | source = "registry+https://github.com/rust-lang/crates.io-index" 1045 | checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" 1046 | 1047 | [[package]] 1048 | name = "winapi" 1049 | version = "0.2.8" 1050 | source = "registry+https://github.com/rust-lang/crates.io-index" 1051 | checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" 1052 | 1053 | [[package]] 1054 | name = "winapi" 1055 | version = "0.3.9" 1056 | source = "registry+https://github.com/rust-lang/crates.io-index" 1057 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1058 | dependencies = [ 1059 | "winapi-i686-pc-windows-gnu", 1060 | "winapi-x86_64-pc-windows-gnu", 1061 | ] 1062 | 1063 | [[package]] 1064 | name = "winapi-build" 1065 | version = "0.1.1" 1066 | source = "registry+https://github.com/rust-lang/crates.io-index" 1067 | checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" 1068 | 1069 | [[package]] 1070 | name = "winapi-i686-pc-windows-gnu" 1071 | version = "0.4.0" 1072 | source = "registry+https://github.com/rust-lang/crates.io-index" 1073 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1074 | 1075 | [[package]] 1076 | name = "winapi-util" 1077 | version = "0.1.5" 1078 | source = "registry+https://github.com/rust-lang/crates.io-index" 1079 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" 1080 | dependencies = [ 1081 | "winapi 0.3.9", 1082 | ] 1083 | 1084 | [[package]] 1085 | name = "winapi-x86_64-pc-windows-gnu" 1086 | version = "0.4.0" 1087 | source = "registry+https://github.com/rust-lang/crates.io-index" 1088 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1089 | 1090 | [[package]] 1091 | name = "ws2_32-sys" 1092 | version = "0.2.1" 1093 | source = "registry+https://github.com/rust-lang/crates.io-index" 1094 | checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" 1095 | dependencies = [ 1096 | "winapi 0.2.8", 1097 | "winapi-build", 1098 | ] 1099 | 1100 | [[package]] 1101 | name = "yansi" 1102 | version = "0.5.0" 1103 | source = "registry+https://github.com/rust-lang/crates.io-index" 1104 | checksum = "9fc79f4a1e39857fc00c3f662cbf2651c771f00e9c15fe2abc341806bd46bd71" 1105 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rust-rocket-webapi" 3 | version = "0.1.0" 4 | authors = ["taikou-kobayashi-mg "] 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 | rocket = "0.4" 11 | rocket_contrib = { version = "0.4", features = ["json"] } 12 | serde = { version = "1.0", features = ["derive"] } 13 | serde_json = "1.0.0" -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # install 2 | rustup install nightly 3 | 4 | # run 5 | cargo run 6 | 7 | # web 8 | http://localhost:8000 -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | #![feature(proc_macro_hygiene)] 2 | #![feature(decl_macro)] 3 | 4 | #[macro_use] 5 | extern crate rocket; 6 | 7 | mod models; 8 | mod routes; 9 | 10 | // WebAPIのURLルーティングはroutes.rsに移動する 11 | use routes::*; 12 | 13 | fn main() { 14 | rocket::ignite() 15 | .mount("/", routes![index, api, todos, new_todo, todo_by_id]) 16 | .launch(); 17 | } -------------------------------------------------------------------------------- /src/models.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | 3 | /// TODOのモデルはmodels.rsに定義 4 | #[derive(Debug, Serialize, Deserialize)] 5 | pub struct ToDo { 6 | pub id: u32, 7 | pub title: String, 8 | pub description: String, 9 | pub done: bool, 10 | } -------------------------------------------------------------------------------- /src/routes.rs: -------------------------------------------------------------------------------- 1 | // JSONを返すのに必要 2 | use rocket_contrib::json::Json; 3 | 4 | use crate::models::ToDo; 5 | 6 | #[get("/")] 7 | pub fn index() -> &'static str { 8 | "Hello, world!" 9 | } 10 | 11 | #[get("/api")] 12 | pub fn api() -> &'static str { 13 | "Hello, world!" 14 | } 15 | 16 | /// TODOリストを返す。 17 | /// Jsonの型がResponderをimplしているので、JSON文字列を返すことができる 18 | #[get("/todos")] 19 | pub fn todos() -> Json> { 20 | Json(vec![ToDo { 21 | id: 1, 22 | title: "Read Rocket tutorial".into(), 23 | description: "Read https://rocket.rs/guide/quickstart/".into(), 24 | done: false, 25 | }]) 26 | } 27 | 28 | /// 新しいTODOを作成する 29 | /// POSTの時はこうする 30 | #[post("/todos", data = "")] 31 | pub fn new_todo(todo: Json) -> String { 32 | format!("Accepted post request! {:?}", todo.0) 33 | } 34 | 35 | /// TODOを取得する 36 | #[get("/todos/")] 37 | pub fn todo_by_id(todoid: u32) -> String { 38 | let todo = ToDo { 39 | id: 1, 40 | title: "Read Rocket tutorial".into(), 41 | description: "Read https://rocket.rs/guide/quickstart/".into(), 42 | done: false, 43 | }; 44 | format!("{:?}", todo) 45 | } --------------------------------------------------------------------------------