├── .env ├── .gitignore ├── .travis.yml ├── Cargo.lock ├── Cargo.toml ├── README.md ├── api ├── .DS_Store ├── Cargo.toml └── src │ ├── error_response.rs │ ├── handlers.rs │ ├── main.rs │ ├── server.rs │ └── state.rs ├── database ├── Cargo.toml ├── migrations │ └── V1__initial.sql └── src │ ├── db_error.rs │ ├── lib.rs │ ├── migration.rs │ └── postgres.rs ├── docker-compose.yaml ├── models ├── Cargo.toml └── src │ ├── lib.rs │ ├── pet.rs │ └── repository.rs └── oas └── v1.yaml /.env: -------------------------------------------------------------------------------- 1 | DATABASE_URL=postgres://example:example@localhost:5432/example -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | .idea 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: rust 2 | script: 3 | - cargo build --verbose --all 4 | - cargo test --verbose --all -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | [[package]] 4 | name = "addr2line" 5 | version = "0.12.2" 6 | source = "registry+https://github.com/rust-lang/crates.io-index" 7 | checksum = "602d785912f476e480434627e8732e6766b760c045bbf897d9dfaa9f4fbd399c" 8 | dependencies = [ 9 | "gimli", 10 | ] 11 | 12 | [[package]] 13 | name = "adler32" 14 | version = "1.1.0" 15 | source = "registry+https://github.com/rust-lang/crates.io-index" 16 | checksum = "567b077b825e468cc974f0020d4082ee6e03132512f207ef1a02fd5d00d1f32d" 17 | 18 | [[package]] 19 | name = "aead" 20 | version = "0.2.0" 21 | source = "registry+https://github.com/rust-lang/crates.io-index" 22 | checksum = "4cf01b9b56e767bb57b94ebf91a58b338002963785cdd7013e21c0d4679471e4" 23 | dependencies = [ 24 | "generic-array", 25 | ] 26 | 27 | [[package]] 28 | name = "aes" 29 | version = "0.3.2" 30 | source = "registry+https://github.com/rust-lang/crates.io-index" 31 | checksum = "54eb1d8fe354e5fc611daf4f2ea97dd45a765f4f1e4512306ec183ae2e8f20c9" 32 | dependencies = [ 33 | "aes-soft", 34 | "aesni", 35 | "block-cipher-trait", 36 | ] 37 | 38 | [[package]] 39 | name = "aes-gcm" 40 | version = "0.5.0" 41 | source = "registry+https://github.com/rust-lang/crates.io-index" 42 | checksum = "834a6bda386024dbb7c8fc51322856c10ffe69559f972261c868485f5759c638" 43 | dependencies = [ 44 | "aead", 45 | "aes", 46 | "block-cipher-trait", 47 | "ghash", 48 | "subtle 2.2.3", 49 | "zeroize", 50 | ] 51 | 52 | [[package]] 53 | name = "aes-soft" 54 | version = "0.3.3" 55 | source = "registry+https://github.com/rust-lang/crates.io-index" 56 | checksum = "cfd7e7ae3f9a1fb5c03b389fc6bb9a51400d0c13053f0dca698c832bfd893a0d" 57 | dependencies = [ 58 | "block-cipher-trait", 59 | "byteorder", 60 | "opaque-debug", 61 | ] 62 | 63 | [[package]] 64 | name = "aesni" 65 | version = "0.6.0" 66 | source = "registry+https://github.com/rust-lang/crates.io-index" 67 | checksum = "2f70a6b5f971e473091ab7cfb5ffac6cde81666c4556751d8d5620ead8abf100" 68 | dependencies = [ 69 | "block-cipher-trait", 70 | "opaque-debug", 71 | ] 72 | 73 | [[package]] 74 | name = "aho-corasick" 75 | version = "0.7.13" 76 | source = "registry+https://github.com/rust-lang/crates.io-index" 77 | checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" 78 | dependencies = [ 79 | "memchr", 80 | ] 81 | 82 | [[package]] 83 | name = "anyhow" 84 | version = "1.0.31" 85 | source = "registry+https://github.com/rust-lang/crates.io-index" 86 | checksum = "85bb70cc08ec97ca5450e6eba421deeea5f172c0fc61f78b5357b2a8e8be195f" 87 | 88 | [[package]] 89 | name = "async-attributes" 90 | version = "1.1.1" 91 | source = "registry+https://github.com/rust-lang/crates.io-index" 92 | checksum = "efd3d156917d94862e779f356c5acae312b08fd3121e792c857d7928c8088423" 93 | dependencies = [ 94 | "quote 1.0.7", 95 | "syn 1.0.33", 96 | ] 97 | 98 | [[package]] 99 | name = "async-h1" 100 | version = "2.0.2" 101 | source = "registry+https://github.com/rust-lang/crates.io-index" 102 | checksum = "7c966ee4e290159619bdc5282ba252749386552be066dbcf5b97adf612798a9a" 103 | dependencies = [ 104 | "async-std", 105 | "byte-pool", 106 | "futures-core", 107 | "http-types", 108 | "httparse", 109 | "lazy_static", 110 | "log", 111 | "pin-project-lite", 112 | ] 113 | 114 | [[package]] 115 | name = "async-log" 116 | version = "1.1.0" 117 | source = "registry+https://github.com/rust-lang/crates.io-index" 118 | checksum = "f5ba33304f3165922dd93565a36dda8ac96c28b1a926ad535ec904e48ecad59b" 119 | dependencies = [ 120 | "async-log-attributes", 121 | "backtrace", 122 | "log", 123 | ] 124 | 125 | [[package]] 126 | name = "async-log-attributes" 127 | version = "1.0.1" 128 | source = "registry+https://github.com/rust-lang/crates.io-index" 129 | checksum = "da97f8e61b19a72f67d8932de8b0905f7d41a1d7b9501b9938c7755f96f6362d" 130 | dependencies = [ 131 | "proc-macro2 0.4.30", 132 | "quote 0.6.13", 133 | "syn 0.15.44", 134 | ] 135 | 136 | [[package]] 137 | name = "async-native-tls" 138 | version = "0.3.3" 139 | source = "registry+https://github.com/rust-lang/crates.io-index" 140 | checksum = "9e9e7a929bd34c68a82d58a4de7f86fffdaf97fb2af850162a7bb19dd7269b33" 141 | dependencies = [ 142 | "async-std", 143 | "native-tls", 144 | "thiserror", 145 | "url", 146 | ] 147 | 148 | [[package]] 149 | name = "async-sse" 150 | version = "3.0.0" 151 | source = "registry+https://github.com/rust-lang/crates.io-index" 152 | checksum = "aff0a3074c2c3cfd76417f6e03d5c99822d3ef37387af891e4a8bf46447ca870" 153 | dependencies = [ 154 | "async-std", 155 | "http-types", 156 | "log", 157 | "memchr", 158 | "pin-project-lite", 159 | ] 160 | 161 | [[package]] 162 | name = "async-std" 163 | version = "1.6.2" 164 | source = "registry+https://github.com/rust-lang/crates.io-index" 165 | checksum = "00d68a33ebc8b57800847d00787307f84a562224a14db069b0acefe4c2abbf5d" 166 | dependencies = [ 167 | "async-attributes", 168 | "async-task", 169 | "crossbeam-utils", 170 | "futures-channel", 171 | "futures-core", 172 | "futures-io", 173 | "futures-timer", 174 | "kv-log-macro", 175 | "log", 176 | "memchr", 177 | "num_cpus", 178 | "once_cell", 179 | "pin-project-lite", 180 | "pin-utils", 181 | "slab", 182 | "smol", 183 | "wasm-bindgen-futures", 184 | ] 185 | 186 | [[package]] 187 | name = "async-stream" 188 | version = "0.2.1" 189 | source = "registry+https://github.com/rust-lang/crates.io-index" 190 | checksum = "22068c0c19514942eefcfd4daf8976ef1aad84e61539f95cd200c35202f80af5" 191 | dependencies = [ 192 | "async-stream-impl", 193 | "futures-core", 194 | ] 195 | 196 | [[package]] 197 | name = "async-stream-impl" 198 | version = "0.2.1" 199 | source = "registry+https://github.com/rust-lang/crates.io-index" 200 | checksum = "25f9db3b38af870bf7e5cc649167533b493928e50744e2c30ae350230b414670" 201 | dependencies = [ 202 | "proc-macro2 1.0.18", 203 | "quote 1.0.7", 204 | "syn 1.0.33", 205 | ] 206 | 207 | [[package]] 208 | name = "async-task" 209 | version = "3.0.0" 210 | source = "registry+https://github.com/rust-lang/crates.io-index" 211 | checksum = "c17772156ef2829aadc587461c7753af20b7e8db1529bc66855add962a3b35d3" 212 | 213 | [[package]] 214 | name = "async-trait" 215 | version = "0.1.36" 216 | source = "registry+https://github.com/rust-lang/crates.io-index" 217 | checksum = "a265e3abeffdce30b2e26b7a11b222fe37c6067404001b434101457d0385eb92" 218 | dependencies = [ 219 | "proc-macro2 1.0.18", 220 | "quote 1.0.7", 221 | "syn 1.0.33", 222 | ] 223 | 224 | [[package]] 225 | name = "atty" 226 | version = "0.2.14" 227 | source = "registry+https://github.com/rust-lang/crates.io-index" 228 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 229 | dependencies = [ 230 | "hermit-abi", 231 | "libc", 232 | "winapi 0.3.8", 233 | ] 234 | 235 | [[package]] 236 | name = "autocfg" 237 | version = "1.0.0" 238 | source = "registry+https://github.com/rust-lang/crates.io-index" 239 | checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" 240 | 241 | [[package]] 242 | name = "backtrace" 243 | version = "0.3.49" 244 | source = "registry+https://github.com/rust-lang/crates.io-index" 245 | checksum = "05100821de9e028f12ae3d189176b41ee198341eb8f369956407fea2f5cc666c" 246 | dependencies = [ 247 | "addr2line", 248 | "cfg-if", 249 | "libc", 250 | "miniz_oxide", 251 | "object", 252 | "rustc-demangle", 253 | ] 254 | 255 | [[package]] 256 | name = "barrel" 257 | version = "0.5.8" 258 | source = "registry+https://github.com/rust-lang/crates.io-index" 259 | checksum = "1d8b66fd0f3d416a716d31a19cd1ce66be952a3cba4e20fa71e8ed2259baa726" 260 | 261 | [[package]] 262 | name = "base-x" 263 | version = "0.2.6" 264 | source = "registry+https://github.com/rust-lang/crates.io-index" 265 | checksum = "1b20b618342cf9891c292c4f5ac2cde7287cc5c87e87e9c769d617793607dec1" 266 | 267 | [[package]] 268 | name = "base64" 269 | version = "0.12.3" 270 | source = "registry+https://github.com/rust-lang/crates.io-index" 271 | checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" 272 | 273 | [[package]] 274 | name = "bitflags" 275 | version = "1.2.1" 276 | source = "registry+https://github.com/rust-lang/crates.io-index" 277 | checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" 278 | 279 | [[package]] 280 | name = "block-buffer" 281 | version = "0.7.3" 282 | source = "registry+https://github.com/rust-lang/crates.io-index" 283 | checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" 284 | dependencies = [ 285 | "block-padding", 286 | "byte-tools", 287 | "byteorder", 288 | "generic-array", 289 | ] 290 | 291 | [[package]] 292 | name = "block-cipher-trait" 293 | version = "0.6.2" 294 | source = "registry+https://github.com/rust-lang/crates.io-index" 295 | checksum = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774" 296 | dependencies = [ 297 | "generic-array", 298 | ] 299 | 300 | [[package]] 301 | name = "block-padding" 302 | version = "0.1.5" 303 | source = "registry+https://github.com/rust-lang/crates.io-index" 304 | checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" 305 | dependencies = [ 306 | "byte-tools", 307 | ] 308 | 309 | [[package]] 310 | name = "blocking" 311 | version = "0.4.6" 312 | source = "registry+https://github.com/rust-lang/crates.io-index" 313 | checksum = "9d17efb70ce4421e351d61aafd90c16a20fb5bfe339fcdc32a86816280e62ce0" 314 | dependencies = [ 315 | "futures-channel", 316 | "futures-util", 317 | "once_cell", 318 | "parking", 319 | "waker-fn", 320 | ] 321 | 322 | [[package]] 323 | name = "bumpalo" 324 | version = "3.4.0" 325 | source = "registry+https://github.com/rust-lang/crates.io-index" 326 | checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" 327 | 328 | [[package]] 329 | name = "byte-pool" 330 | version = "0.2.1" 331 | source = "registry+https://github.com/rust-lang/crates.io-index" 332 | checksum = "9342e102eac8b1879fbedf9a7e0572c40b0cc5805b663c4d4ca791cae0bae221" 333 | dependencies = [ 334 | "crossbeam-queue", 335 | "stable_deref_trait", 336 | ] 337 | 338 | [[package]] 339 | name = "byte-tools" 340 | version = "0.3.1" 341 | source = "registry+https://github.com/rust-lang/crates.io-index" 342 | checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" 343 | 344 | [[package]] 345 | name = "byteorder" 346 | version = "1.3.4" 347 | source = "registry+https://github.com/rust-lang/crates.io-index" 348 | checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" 349 | 350 | [[package]] 351 | name = "bytes" 352 | version = "0.5.5" 353 | source = "registry+https://github.com/rust-lang/crates.io-index" 354 | checksum = "118cf036fbb97d0816e3c34b2d7a1e8cfc60f68fcf63d550ddbe9bd5f59c213b" 355 | dependencies = [ 356 | "loom", 357 | ] 358 | 359 | [[package]] 360 | name = "cache-padded" 361 | version = "1.1.0" 362 | source = "registry+https://github.com/rust-lang/crates.io-index" 363 | checksum = "24508e28c677875c380c20f4d28124fab6f8ed4ef929a1397d7b1a31e92f1005" 364 | 365 | [[package]] 366 | name = "cc" 367 | version = "1.0.54" 368 | source = "registry+https://github.com/rust-lang/crates.io-index" 369 | checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311" 370 | 371 | [[package]] 372 | name = "cfg-if" 373 | version = "0.1.10" 374 | source = "registry+https://github.com/rust-lang/crates.io-index" 375 | checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" 376 | 377 | [[package]] 378 | name = "chrono" 379 | version = "0.4.11" 380 | source = "registry+https://github.com/rust-lang/crates.io-index" 381 | checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" 382 | dependencies = [ 383 | "num-integer", 384 | "num-traits", 385 | "time 0.1.43", 386 | ] 387 | 388 | [[package]] 389 | name = "clicolors-control" 390 | version = "1.0.1" 391 | source = "registry+https://github.com/rust-lang/crates.io-index" 392 | checksum = "90082ee5dcdd64dc4e9e0d37fbf3ee325419e39c0092191e0393df65518f741e" 393 | dependencies = [ 394 | "atty", 395 | "lazy_static", 396 | "libc", 397 | "winapi 0.3.8", 398 | ] 399 | 400 | [[package]] 401 | name = "cloudabi" 402 | version = "0.0.3" 403 | source = "registry+https://github.com/rust-lang/crates.io-index" 404 | checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" 405 | dependencies = [ 406 | "bitflags", 407 | ] 408 | 409 | [[package]] 410 | name = "cloudabi" 411 | version = "0.1.0" 412 | source = "registry+https://github.com/rust-lang/crates.io-index" 413 | checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" 414 | dependencies = [ 415 | "bitflags", 416 | ] 417 | 418 | [[package]] 419 | name = "concurrent-queue" 420 | version = "1.1.1" 421 | source = "registry+https://github.com/rust-lang/crates.io-index" 422 | checksum = "f83c06aff61f2d899eb87c379df3cbf7876f14471dcab474e0b6dc90ab96c080" 423 | dependencies = [ 424 | "cache-padded", 425 | ] 426 | 427 | [[package]] 428 | name = "console" 429 | version = "0.7.7" 430 | source = "registry+https://github.com/rust-lang/crates.io-index" 431 | checksum = "8ca57c2c14b8a2bf3105bc9d15574aad80babf6a9c44b1058034cdf8bd169628" 432 | dependencies = [ 433 | "atty", 434 | "clicolors-control", 435 | "encode_unicode", 436 | "lazy_static", 437 | "libc", 438 | "parking_lot 0.11.0", 439 | "regex", 440 | "termios", 441 | "unicode-width", 442 | "winapi 0.3.8", 443 | ] 444 | 445 | [[package]] 446 | name = "cookie" 447 | version = "0.14.1" 448 | source = "registry+https://github.com/rust-lang/crates.io-index" 449 | checksum = "ca761767cf3fa9068cc893ec8c247a22d0fd0535848e65640c0548bd1f8bbb36" 450 | dependencies = [ 451 | "aes-gcm", 452 | "base64", 453 | "hkdf", 454 | "hmac", 455 | "percent-encoding", 456 | "rand", 457 | "sha2", 458 | "time 0.2.16", 459 | ] 460 | 461 | [[package]] 462 | name = "core-foundation" 463 | version = "0.7.0" 464 | source = "registry+https://github.com/rust-lang/crates.io-index" 465 | checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" 466 | dependencies = [ 467 | "core-foundation-sys", 468 | "libc", 469 | ] 470 | 471 | [[package]] 472 | name = "core-foundation-sys" 473 | version = "0.7.0" 474 | source = "registry+https://github.com/rust-lang/crates.io-index" 475 | checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" 476 | 477 | [[package]] 478 | name = "crossbeam-queue" 479 | version = "0.2.3" 480 | source = "registry+https://github.com/rust-lang/crates.io-index" 481 | checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" 482 | dependencies = [ 483 | "cfg-if", 484 | "crossbeam-utils", 485 | "maybe-uninit", 486 | ] 487 | 488 | [[package]] 489 | name = "crossbeam-utils" 490 | version = "0.7.2" 491 | source = "registry+https://github.com/rust-lang/crates.io-index" 492 | checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" 493 | dependencies = [ 494 | "autocfg", 495 | "cfg-if", 496 | "lazy_static", 497 | ] 498 | 499 | [[package]] 500 | name = "crypto-mac" 501 | version = "0.7.0" 502 | source = "registry+https://github.com/rust-lang/crates.io-index" 503 | checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" 504 | dependencies = [ 505 | "generic-array", 506 | "subtle 1.0.0", 507 | ] 508 | 509 | [[package]] 510 | name = "data-encoding" 511 | version = "2.2.1" 512 | source = "registry+https://github.com/rust-lang/crates.io-index" 513 | checksum = "72aa14c04dfae8dd7d8a2b1cb7ca2152618cd01336dbfe704b8dcbf8d41dbd69" 514 | 515 | [[package]] 516 | name = "database" 517 | version = "0.1.0" 518 | dependencies = [ 519 | "async-trait", 520 | "models", 521 | "postgres", 522 | "refinery 0.3.0", 523 | "sql-builder", 524 | "sqlx", 525 | ] 526 | 527 | [[package]] 528 | name = "difference" 529 | version = "2.0.0" 530 | source = "registry+https://github.com/rust-lang/crates.io-index" 531 | checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" 532 | 533 | [[package]] 534 | name = "digest" 535 | version = "0.8.1" 536 | source = "registry+https://github.com/rust-lang/crates.io-index" 537 | checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" 538 | dependencies = [ 539 | "generic-array", 540 | ] 541 | 542 | [[package]] 543 | name = "discard" 544 | version = "1.0.4" 545 | source = "registry+https://github.com/rust-lang/crates.io-index" 546 | checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" 547 | 548 | [[package]] 549 | name = "dotenv" 550 | version = "0.15.0" 551 | source = "registry+https://github.com/rust-lang/crates.io-index" 552 | checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" 553 | 554 | [[package]] 555 | name = "downcast" 556 | version = "0.10.0" 557 | source = "registry+https://github.com/rust-lang/crates.io-index" 558 | checksum = "4bb454f0228b18c7f4c3b0ebbee346ed9c52e7443b0999cd543ff3571205701d" 559 | 560 | [[package]] 561 | name = "dtoa" 562 | version = "0.4.6" 563 | source = "registry+https://github.com/rust-lang/crates.io-index" 564 | checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b" 565 | 566 | [[package]] 567 | name = "encode_unicode" 568 | version = "0.3.6" 569 | source = "registry+https://github.com/rust-lang/crates.io-index" 570 | checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" 571 | 572 | [[package]] 573 | name = "env_logger" 574 | version = "0.7.1" 575 | source = "registry+https://github.com/rust-lang/crates.io-index" 576 | checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" 577 | dependencies = [ 578 | "atty", 579 | "humantime", 580 | "log", 581 | "regex", 582 | "termcolor", 583 | ] 584 | 585 | [[package]] 586 | name = "error-chain" 587 | version = "0.12.2" 588 | source = "registry+https://github.com/rust-lang/crates.io-index" 589 | checksum = "d371106cc88ffdfb1eabd7111e432da544f16f3e2d7bf1dfe8bf575f1df045cd" 590 | dependencies = [ 591 | "backtrace", 592 | "version_check", 593 | ] 594 | 595 | [[package]] 596 | name = "example-rust-api" 597 | version = "0.1.0" 598 | dependencies = [ 599 | "async-std", 600 | "async-trait", 601 | "database", 602 | "dotenv", 603 | "env_logger", 604 | "femme 1.3.0", 605 | "http-types", 606 | "log", 607 | "mockall", 608 | "models", 609 | "postgres", 610 | "refinery 0.2.1", 611 | "serde", 612 | "serde_derive", 613 | "serde_json", 614 | "tide", 615 | ] 616 | 617 | [[package]] 618 | name = "fake-simd" 619 | version = "0.1.2" 620 | source = "registry+https://github.com/rust-lang/crates.io-index" 621 | checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" 622 | 623 | [[package]] 624 | name = "fallible-iterator" 625 | version = "0.2.0" 626 | source = "registry+https://github.com/rust-lang/crates.io-index" 627 | checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" 628 | 629 | [[package]] 630 | name = "fastrand" 631 | version = "1.2.4" 632 | source = "registry+https://github.com/rust-lang/crates.io-index" 633 | checksum = "a64b0126b293b050395b37b10489951590ed024c03d7df4f249d219c8ded7cbf" 634 | 635 | [[package]] 636 | name = "femme" 637 | version = "1.3.0" 638 | source = "registry+https://github.com/rust-lang/crates.io-index" 639 | checksum = "4d9ac2da60a2a97a0643d082f1cb25901a90e6f2f69f03baf9763721aa31ee6a" 640 | dependencies = [ 641 | "async-log", 642 | "cfg-if", 643 | "console", 644 | "js-sys", 645 | "log", 646 | "serde", 647 | "serde_derive", 648 | "serde_json", 649 | "wasm-bindgen", 650 | "web-sys", 651 | ] 652 | 653 | [[package]] 654 | name = "femme" 655 | version = "2.1.0" 656 | source = "registry+https://github.com/rust-lang/crates.io-index" 657 | checksum = "7b6b21baebbed15551f2170010ca4101b9ed3fdc05822791c8bd4631840eab81" 658 | dependencies = [ 659 | "cfg-if", 660 | "js-sys", 661 | "log", 662 | "serde", 663 | "serde_derive", 664 | "wasm-bindgen", 665 | "web-sys", 666 | ] 667 | 668 | [[package]] 669 | name = "float-cmp" 670 | version = "0.6.0" 671 | source = "registry+https://github.com/rust-lang/crates.io-index" 672 | checksum = "da62c4f1b81918835a8c6a484a397775fff5953fe83529afd51b05f5c6a6617d" 673 | dependencies = [ 674 | "num-traits", 675 | ] 676 | 677 | [[package]] 678 | name = "foreign-types" 679 | version = "0.3.2" 680 | source = "registry+https://github.com/rust-lang/crates.io-index" 681 | checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" 682 | dependencies = [ 683 | "foreign-types-shared", 684 | ] 685 | 686 | [[package]] 687 | name = "foreign-types-shared" 688 | version = "0.1.1" 689 | source = "registry+https://github.com/rust-lang/crates.io-index" 690 | checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" 691 | 692 | [[package]] 693 | name = "fragile" 694 | version = "1.0.0" 695 | source = "registry+https://github.com/rust-lang/crates.io-index" 696 | checksum = "69a039c3498dc930fe810151a34ba0c1c70b02b8625035592e74432f678591f2" 697 | 698 | [[package]] 699 | name = "fuchsia-zircon" 700 | version = "0.3.3" 701 | source = "registry+https://github.com/rust-lang/crates.io-index" 702 | checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" 703 | dependencies = [ 704 | "bitflags", 705 | "fuchsia-zircon-sys", 706 | ] 707 | 708 | [[package]] 709 | name = "fuchsia-zircon-sys" 710 | version = "0.3.3" 711 | source = "registry+https://github.com/rust-lang/crates.io-index" 712 | checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" 713 | 714 | [[package]] 715 | name = "futures" 716 | version = "0.3.5" 717 | source = "registry+https://github.com/rust-lang/crates.io-index" 718 | checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613" 719 | dependencies = [ 720 | "futures-channel", 721 | "futures-core", 722 | "futures-executor", 723 | "futures-io", 724 | "futures-sink", 725 | "futures-task", 726 | "futures-util", 727 | ] 728 | 729 | [[package]] 730 | name = "futures-channel" 731 | version = "0.3.5" 732 | source = "registry+https://github.com/rust-lang/crates.io-index" 733 | checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5" 734 | dependencies = [ 735 | "futures-core", 736 | "futures-sink", 737 | ] 738 | 739 | [[package]] 740 | name = "futures-core" 741 | version = "0.3.5" 742 | source = "registry+https://github.com/rust-lang/crates.io-index" 743 | checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399" 744 | 745 | [[package]] 746 | name = "futures-executor" 747 | version = "0.3.5" 748 | source = "registry+https://github.com/rust-lang/crates.io-index" 749 | checksum = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314" 750 | dependencies = [ 751 | "futures-core", 752 | "futures-task", 753 | "futures-util", 754 | ] 755 | 756 | [[package]] 757 | name = "futures-io" 758 | version = "0.3.5" 759 | source = "registry+https://github.com/rust-lang/crates.io-index" 760 | checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789" 761 | 762 | [[package]] 763 | name = "futures-macro" 764 | version = "0.3.5" 765 | source = "registry+https://github.com/rust-lang/crates.io-index" 766 | checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39" 767 | dependencies = [ 768 | "proc-macro-hack", 769 | "proc-macro2 1.0.18", 770 | "quote 1.0.7", 771 | "syn 1.0.33", 772 | ] 773 | 774 | [[package]] 775 | name = "futures-sink" 776 | version = "0.3.5" 777 | source = "registry+https://github.com/rust-lang/crates.io-index" 778 | checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc" 779 | 780 | [[package]] 781 | name = "futures-task" 782 | version = "0.3.5" 783 | source = "registry+https://github.com/rust-lang/crates.io-index" 784 | checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626" 785 | dependencies = [ 786 | "once_cell", 787 | ] 788 | 789 | [[package]] 790 | name = "futures-timer" 791 | version = "3.0.2" 792 | source = "registry+https://github.com/rust-lang/crates.io-index" 793 | checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" 794 | dependencies = [ 795 | "gloo-timers", 796 | "send_wrapper", 797 | ] 798 | 799 | [[package]] 800 | name = "futures-util" 801 | version = "0.3.5" 802 | source = "registry+https://github.com/rust-lang/crates.io-index" 803 | checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" 804 | dependencies = [ 805 | "futures-channel", 806 | "futures-core", 807 | "futures-io", 808 | "futures-macro", 809 | "futures-sink", 810 | "futures-task", 811 | "memchr", 812 | "pin-project", 813 | "pin-utils", 814 | "proc-macro-hack", 815 | "proc-macro-nested", 816 | "slab", 817 | ] 818 | 819 | [[package]] 820 | name = "generator" 821 | version = "0.6.21" 822 | source = "registry+https://github.com/rust-lang/crates.io-index" 823 | checksum = "add72f17bb81521258fcc8a7a3245b1e184e916bfbe34f0ea89558f440df5c68" 824 | dependencies = [ 825 | "cc", 826 | "libc", 827 | "log", 828 | "rustc_version", 829 | "winapi 0.3.8", 830 | ] 831 | 832 | [[package]] 833 | name = "generic-array" 834 | version = "0.12.3" 835 | source = "registry+https://github.com/rust-lang/crates.io-index" 836 | checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" 837 | dependencies = [ 838 | "typenum", 839 | ] 840 | 841 | [[package]] 842 | name = "getrandom" 843 | version = "0.1.14" 844 | source = "registry+https://github.com/rust-lang/crates.io-index" 845 | checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" 846 | dependencies = [ 847 | "cfg-if", 848 | "libc", 849 | "wasi", 850 | ] 851 | 852 | [[package]] 853 | name = "ghash" 854 | version = "0.2.3" 855 | source = "registry+https://github.com/rust-lang/crates.io-index" 856 | checksum = "9f0930ed19a7184089ea46d2fedead2f6dc2b674c5db4276b7da336c7cd83252" 857 | dependencies = [ 858 | "polyval", 859 | ] 860 | 861 | [[package]] 862 | name = "gimli" 863 | version = "0.21.0" 864 | source = "registry+https://github.com/rust-lang/crates.io-index" 865 | checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c" 866 | 867 | [[package]] 868 | name = "gloo-timers" 869 | version = "0.2.1" 870 | source = "registry+https://github.com/rust-lang/crates.io-index" 871 | checksum = "47204a46aaff920a1ea58b11d03dec6f704287d27561724a4631e450654a891f" 872 | dependencies = [ 873 | "futures-channel", 874 | "futures-core", 875 | "js-sys", 876 | "wasm-bindgen", 877 | "web-sys", 878 | ] 879 | 880 | [[package]] 881 | name = "heck" 882 | version = "0.3.1" 883 | source = "registry+https://github.com/rust-lang/crates.io-index" 884 | checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" 885 | dependencies = [ 886 | "unicode-segmentation", 887 | ] 888 | 889 | [[package]] 890 | name = "hermit-abi" 891 | version = "0.1.14" 892 | source = "registry+https://github.com/rust-lang/crates.io-index" 893 | checksum = "b9586eedd4ce6b3c498bc3b4dd92fc9f11166aa908a914071953768066c67909" 894 | dependencies = [ 895 | "libc", 896 | ] 897 | 898 | [[package]] 899 | name = "hex" 900 | version = "0.4.2" 901 | source = "registry+https://github.com/rust-lang/crates.io-index" 902 | checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" 903 | 904 | [[package]] 905 | name = "hkdf" 906 | version = "0.8.0" 907 | source = "registry+https://github.com/rust-lang/crates.io-index" 908 | checksum = "3fa08a006102488bd9cd5b8013aabe84955cf5ae22e304c2caf655b633aefae3" 909 | dependencies = [ 910 | "digest", 911 | "hmac", 912 | ] 913 | 914 | [[package]] 915 | name = "hmac" 916 | version = "0.7.1" 917 | source = "registry+https://github.com/rust-lang/crates.io-index" 918 | checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" 919 | dependencies = [ 920 | "crypto-mac", 921 | "digest", 922 | ] 923 | 924 | [[package]] 925 | name = "http-types" 926 | version = "2.2.1" 927 | source = "registry+https://github.com/rust-lang/crates.io-index" 928 | checksum = "ca4221cd1c7cedf275cd0ad3c9dfe58b5acc93cdd5511c7e020a102e1995fe99" 929 | dependencies = [ 930 | "anyhow", 931 | "async-std", 932 | "cookie", 933 | "infer", 934 | "pin-project-lite", 935 | "rand", 936 | "serde", 937 | "serde_json", 938 | "serde_qs", 939 | "serde_urlencoded", 940 | "url", 941 | ] 942 | 943 | [[package]] 944 | name = "httparse" 945 | version = "1.3.4" 946 | source = "registry+https://github.com/rust-lang/crates.io-index" 947 | checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" 948 | 949 | [[package]] 950 | name = "humantime" 951 | version = "1.3.0" 952 | source = "registry+https://github.com/rust-lang/crates.io-index" 953 | checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" 954 | dependencies = [ 955 | "quick-error", 956 | ] 957 | 958 | [[package]] 959 | name = "idna" 960 | version = "0.2.0" 961 | source = "registry+https://github.com/rust-lang/crates.io-index" 962 | checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" 963 | dependencies = [ 964 | "matches", 965 | "unicode-bidi", 966 | "unicode-normalization", 967 | ] 968 | 969 | [[package]] 970 | name = "infer" 971 | version = "0.1.7" 972 | source = "registry+https://github.com/rust-lang/crates.io-index" 973 | checksum = "6854dd77ddc4f9ba1a448f487e27843583d407648150426a30c2ea3a2c39490a" 974 | 975 | [[package]] 976 | name = "instant" 977 | version = "0.1.4" 978 | source = "registry+https://github.com/rust-lang/crates.io-index" 979 | checksum = "7777a24a1ce5de49fcdde84ec46efa487c3af49d5b6e6e0a50367cc5c1096182" 980 | 981 | [[package]] 982 | name = "iovec" 983 | version = "0.1.4" 984 | source = "registry+https://github.com/rust-lang/crates.io-index" 985 | checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" 986 | dependencies = [ 987 | "libc", 988 | ] 989 | 990 | [[package]] 991 | name = "itoa" 992 | version = "0.4.6" 993 | source = "registry+https://github.com/rust-lang/crates.io-index" 994 | checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" 995 | 996 | [[package]] 997 | name = "js-sys" 998 | version = "0.3.40" 999 | source = "registry+https://github.com/rust-lang/crates.io-index" 1000 | checksum = "ce10c23ad2ea25ceca0093bd3192229da4c5b3c0f2de499c1ecac0d98d452177" 1001 | dependencies = [ 1002 | "wasm-bindgen", 1003 | ] 1004 | 1005 | [[package]] 1006 | name = "kernel32-sys" 1007 | version = "0.2.2" 1008 | source = "registry+https://github.com/rust-lang/crates.io-index" 1009 | checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" 1010 | dependencies = [ 1011 | "winapi 0.2.8", 1012 | "winapi-build", 1013 | ] 1014 | 1015 | [[package]] 1016 | name = "kv-log-macro" 1017 | version = "1.0.6" 1018 | source = "registry+https://github.com/rust-lang/crates.io-index" 1019 | checksum = "4ff57d6d215f7ca7eb35a9a64d656ba4d9d2bef114d741dc08048e75e2f5d418" 1020 | dependencies = [ 1021 | "log", 1022 | ] 1023 | 1024 | [[package]] 1025 | name = "lazy_static" 1026 | version = "1.4.0" 1027 | source = "registry+https://github.com/rust-lang/crates.io-index" 1028 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 1029 | 1030 | [[package]] 1031 | name = "libc" 1032 | version = "0.2.71" 1033 | source = "registry+https://github.com/rust-lang/crates.io-index" 1034 | checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49" 1035 | 1036 | [[package]] 1037 | name = "lock_api" 1038 | version = "0.3.4" 1039 | source = "registry+https://github.com/rust-lang/crates.io-index" 1040 | checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" 1041 | dependencies = [ 1042 | "scopeguard", 1043 | ] 1044 | 1045 | [[package]] 1046 | name = "lock_api" 1047 | version = "0.4.0" 1048 | source = "registry+https://github.com/rust-lang/crates.io-index" 1049 | checksum = "de302ce1fe7482db13738fbaf2e21cfb06a986b89c0bf38d88abf16681aada4e" 1050 | dependencies = [ 1051 | "scopeguard", 1052 | ] 1053 | 1054 | [[package]] 1055 | name = "log" 1056 | version = "0.4.8" 1057 | source = "registry+https://github.com/rust-lang/crates.io-index" 1058 | checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" 1059 | dependencies = [ 1060 | "cfg-if", 1061 | ] 1062 | 1063 | [[package]] 1064 | name = "loom" 1065 | version = "0.3.4" 1066 | source = "registry+https://github.com/rust-lang/crates.io-index" 1067 | checksum = "4ecc775857611e1df29abba5c41355cdf540e7e9d4acfdf0f355eefee82330b7" 1068 | dependencies = [ 1069 | "cfg-if", 1070 | "generator", 1071 | "scoped-tls 0.1.2", 1072 | ] 1073 | 1074 | [[package]] 1075 | name = "maplit" 1076 | version = "1.0.2" 1077 | source = "registry+https://github.com/rust-lang/crates.io-index" 1078 | checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" 1079 | 1080 | [[package]] 1081 | name = "matches" 1082 | version = "0.1.8" 1083 | source = "registry+https://github.com/rust-lang/crates.io-index" 1084 | checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" 1085 | 1086 | [[package]] 1087 | name = "maybe-uninit" 1088 | version = "2.0.0" 1089 | source = "registry+https://github.com/rust-lang/crates.io-index" 1090 | checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" 1091 | 1092 | [[package]] 1093 | name = "md-5" 1094 | version = "0.8.0" 1095 | source = "registry+https://github.com/rust-lang/crates.io-index" 1096 | checksum = "a18af3dcaf2b0219366cdb4e2af65a6101457b415c3d1a5c71dd9c2b7c77b9c8" 1097 | dependencies = [ 1098 | "block-buffer", 1099 | "digest", 1100 | "opaque-debug", 1101 | ] 1102 | 1103 | [[package]] 1104 | name = "md5" 1105 | version = "0.7.0" 1106 | source = "registry+https://github.com/rust-lang/crates.io-index" 1107 | checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" 1108 | 1109 | [[package]] 1110 | name = "memchr" 1111 | version = "2.3.3" 1112 | source = "registry+https://github.com/rust-lang/crates.io-index" 1113 | checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" 1114 | 1115 | [[package]] 1116 | name = "miniz_oxide" 1117 | version = "0.3.7" 1118 | source = "registry+https://github.com/rust-lang/crates.io-index" 1119 | checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" 1120 | dependencies = [ 1121 | "adler32", 1122 | ] 1123 | 1124 | [[package]] 1125 | name = "mio" 1126 | version = "0.6.22" 1127 | source = "registry+https://github.com/rust-lang/crates.io-index" 1128 | checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" 1129 | dependencies = [ 1130 | "cfg-if", 1131 | "fuchsia-zircon", 1132 | "fuchsia-zircon-sys", 1133 | "iovec", 1134 | "kernel32-sys", 1135 | "libc", 1136 | "log", 1137 | "miow", 1138 | "net2", 1139 | "slab", 1140 | "winapi 0.2.8", 1141 | ] 1142 | 1143 | [[package]] 1144 | name = "mio-uds" 1145 | version = "0.6.8" 1146 | source = "registry+https://github.com/rust-lang/crates.io-index" 1147 | checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" 1148 | dependencies = [ 1149 | "iovec", 1150 | "libc", 1151 | "mio", 1152 | ] 1153 | 1154 | [[package]] 1155 | name = "miow" 1156 | version = "0.2.1" 1157 | source = "registry+https://github.com/rust-lang/crates.io-index" 1158 | checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" 1159 | dependencies = [ 1160 | "kernel32-sys", 1161 | "net2", 1162 | "winapi 0.2.8", 1163 | "ws2_32-sys", 1164 | ] 1165 | 1166 | [[package]] 1167 | name = "mockall" 1168 | version = "0.7.1" 1169 | source = "registry+https://github.com/rust-lang/crates.io-index" 1170 | checksum = "256489d4d106cd2bc9e98ed0337402db0044de0621745d5d9eb70a14295ff77b" 1171 | dependencies = [ 1172 | "cfg-if", 1173 | "downcast", 1174 | "fragile", 1175 | "lazy_static", 1176 | "mockall_derive", 1177 | "predicates", 1178 | "predicates-tree", 1179 | ] 1180 | 1181 | [[package]] 1182 | name = "mockall_derive" 1183 | version = "0.7.1" 1184 | source = "registry+https://github.com/rust-lang/crates.io-index" 1185 | checksum = "826e14e8643cb12103b56efb963e5f9640b69b0f7bdcc460002092df4b0e959f" 1186 | dependencies = [ 1187 | "cfg-if", 1188 | "proc-macro2 1.0.18", 1189 | "quote 1.0.7", 1190 | "syn 1.0.33", 1191 | ] 1192 | 1193 | [[package]] 1194 | name = "models" 1195 | version = "0.1.0" 1196 | dependencies = [ 1197 | "async-trait", 1198 | "serde", 1199 | "serde_derive", 1200 | "sqlx", 1201 | ] 1202 | 1203 | [[package]] 1204 | name = "native-tls" 1205 | version = "0.2.4" 1206 | source = "registry+https://github.com/rust-lang/crates.io-index" 1207 | checksum = "2b0d88c06fe90d5ee94048ba40409ef1d9315d86f6f38c2efdaad4fb50c58b2d" 1208 | dependencies = [ 1209 | "lazy_static", 1210 | "libc", 1211 | "log", 1212 | "openssl", 1213 | "openssl-probe", 1214 | "openssl-sys", 1215 | "schannel", 1216 | "security-framework", 1217 | "security-framework-sys", 1218 | "tempfile", 1219 | ] 1220 | 1221 | [[package]] 1222 | name = "net2" 1223 | version = "0.2.34" 1224 | source = "registry+https://github.com/rust-lang/crates.io-index" 1225 | checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" 1226 | dependencies = [ 1227 | "cfg-if", 1228 | "libc", 1229 | "winapi 0.3.8", 1230 | ] 1231 | 1232 | [[package]] 1233 | name = "normalize-line-endings" 1234 | version = "0.3.0" 1235 | source = "registry+https://github.com/rust-lang/crates.io-index" 1236 | checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" 1237 | 1238 | [[package]] 1239 | name = "num-integer" 1240 | version = "0.1.43" 1241 | source = "registry+https://github.com/rust-lang/crates.io-index" 1242 | checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" 1243 | dependencies = [ 1244 | "autocfg", 1245 | "num-traits", 1246 | ] 1247 | 1248 | [[package]] 1249 | name = "num-traits" 1250 | version = "0.2.12" 1251 | source = "registry+https://github.com/rust-lang/crates.io-index" 1252 | checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" 1253 | dependencies = [ 1254 | "autocfg", 1255 | ] 1256 | 1257 | [[package]] 1258 | name = "num_cpus" 1259 | version = "1.13.0" 1260 | source = "registry+https://github.com/rust-lang/crates.io-index" 1261 | checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" 1262 | dependencies = [ 1263 | "hermit-abi", 1264 | "libc", 1265 | ] 1266 | 1267 | [[package]] 1268 | name = "object" 1269 | version = "0.20.0" 1270 | source = "registry+https://github.com/rust-lang/crates.io-index" 1271 | checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5" 1272 | 1273 | [[package]] 1274 | name = "once_cell" 1275 | version = "1.4.0" 1276 | source = "registry+https://github.com/rust-lang/crates.io-index" 1277 | checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d" 1278 | 1279 | [[package]] 1280 | name = "opaque-debug" 1281 | version = "0.2.3" 1282 | source = "registry+https://github.com/rust-lang/crates.io-index" 1283 | checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" 1284 | 1285 | [[package]] 1286 | name = "openssl" 1287 | version = "0.10.29" 1288 | source = "registry+https://github.com/rust-lang/crates.io-index" 1289 | checksum = "cee6d85f4cb4c4f59a6a85d5b68a233d280c82e29e822913b9c8b129fbf20bdd" 1290 | dependencies = [ 1291 | "bitflags", 1292 | "cfg-if", 1293 | "foreign-types", 1294 | "lazy_static", 1295 | "libc", 1296 | "openssl-sys", 1297 | ] 1298 | 1299 | [[package]] 1300 | name = "openssl-probe" 1301 | version = "0.1.2" 1302 | source = "registry+https://github.com/rust-lang/crates.io-index" 1303 | checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" 1304 | 1305 | [[package]] 1306 | name = "openssl-sys" 1307 | version = "0.9.58" 1308 | source = "registry+https://github.com/rust-lang/crates.io-index" 1309 | checksum = "a842db4709b604f0fe5d1170ae3565899be2ad3d9cbc72dedc789ac0511f78de" 1310 | dependencies = [ 1311 | "autocfg", 1312 | "cc", 1313 | "libc", 1314 | "pkg-config", 1315 | "vcpkg", 1316 | ] 1317 | 1318 | [[package]] 1319 | name = "parking" 1320 | version = "1.0.3" 1321 | source = "registry+https://github.com/rust-lang/crates.io-index" 1322 | checksum = "c4029bc3504a62d92e42f30b9095fdef73b8a0b2a06aa41ce2935143b05a1a06" 1323 | 1324 | [[package]] 1325 | name = "parking_lot" 1326 | version = "0.10.2" 1327 | source = "registry+https://github.com/rust-lang/crates.io-index" 1328 | checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" 1329 | dependencies = [ 1330 | "lock_api 0.3.4", 1331 | "parking_lot_core 0.7.2", 1332 | ] 1333 | 1334 | [[package]] 1335 | name = "parking_lot" 1336 | version = "0.11.0" 1337 | source = "registry+https://github.com/rust-lang/crates.io-index" 1338 | checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733" 1339 | dependencies = [ 1340 | "instant", 1341 | "lock_api 0.4.0", 1342 | "parking_lot_core 0.8.0", 1343 | ] 1344 | 1345 | [[package]] 1346 | name = "parking_lot_core" 1347 | version = "0.7.2" 1348 | source = "registry+https://github.com/rust-lang/crates.io-index" 1349 | checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" 1350 | dependencies = [ 1351 | "cfg-if", 1352 | "cloudabi 0.0.3", 1353 | "libc", 1354 | "redox_syscall", 1355 | "smallvec", 1356 | "winapi 0.3.8", 1357 | ] 1358 | 1359 | [[package]] 1360 | name = "parking_lot_core" 1361 | version = "0.8.0" 1362 | source = "registry+https://github.com/rust-lang/crates.io-index" 1363 | checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" 1364 | dependencies = [ 1365 | "cfg-if", 1366 | "cloudabi 0.1.0", 1367 | "instant", 1368 | "libc", 1369 | "redox_syscall", 1370 | "smallvec", 1371 | "winapi 0.3.8", 1372 | ] 1373 | 1374 | [[package]] 1375 | name = "percent-encoding" 1376 | version = "2.1.0" 1377 | source = "registry+https://github.com/rust-lang/crates.io-index" 1378 | checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" 1379 | 1380 | [[package]] 1381 | name = "phf" 1382 | version = "0.8.0" 1383 | source = "registry+https://github.com/rust-lang/crates.io-index" 1384 | checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" 1385 | dependencies = [ 1386 | "phf_shared", 1387 | ] 1388 | 1389 | [[package]] 1390 | name = "phf_shared" 1391 | version = "0.8.0" 1392 | source = "registry+https://github.com/rust-lang/crates.io-index" 1393 | checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" 1394 | dependencies = [ 1395 | "siphasher", 1396 | ] 1397 | 1398 | [[package]] 1399 | name = "pin-project" 1400 | version = "0.4.22" 1401 | source = "registry+https://github.com/rust-lang/crates.io-index" 1402 | checksum = "12e3a6cdbfe94a5e4572812a0201f8c0ed98c1c452c7b8563ce2276988ef9c17" 1403 | dependencies = [ 1404 | "pin-project-internal", 1405 | ] 1406 | 1407 | [[package]] 1408 | name = "pin-project-internal" 1409 | version = "0.4.22" 1410 | source = "registry+https://github.com/rust-lang/crates.io-index" 1411 | checksum = "6a0ffd45cf79d88737d7cc85bfd5d2894bee1139b356e616fe85dc389c61aaf7" 1412 | dependencies = [ 1413 | "proc-macro2 1.0.18", 1414 | "quote 1.0.7", 1415 | "syn 1.0.33", 1416 | ] 1417 | 1418 | [[package]] 1419 | name = "pin-project-lite" 1420 | version = "0.1.7" 1421 | source = "registry+https://github.com/rust-lang/crates.io-index" 1422 | checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715" 1423 | 1424 | [[package]] 1425 | name = "pin-utils" 1426 | version = "0.1.0" 1427 | source = "registry+https://github.com/rust-lang/crates.io-index" 1428 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 1429 | 1430 | [[package]] 1431 | name = "pkg-config" 1432 | version = "0.3.17" 1433 | source = "registry+https://github.com/rust-lang/crates.io-index" 1434 | checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" 1435 | 1436 | [[package]] 1437 | name = "polyval" 1438 | version = "0.3.3" 1439 | source = "registry+https://github.com/rust-lang/crates.io-index" 1440 | checksum = "7ec3341498978de3bfd12d1b22f1af1de22818f5473a11e8a6ef997989e3a212" 1441 | dependencies = [ 1442 | "cfg-if", 1443 | "universal-hash", 1444 | ] 1445 | 1446 | [[package]] 1447 | name = "postgres" 1448 | version = "0.17.3" 1449 | source = "registry+https://github.com/rust-lang/crates.io-index" 1450 | checksum = "a08e48317fe57088aa1ff4a84a88a8401aee565f4ae5c201aa18d11c573ce350" 1451 | dependencies = [ 1452 | "bytes", 1453 | "fallible-iterator", 1454 | "futures", 1455 | "log", 1456 | "tokio", 1457 | "tokio-postgres", 1458 | ] 1459 | 1460 | [[package]] 1461 | name = "postgres-protocol" 1462 | version = "0.5.1" 1463 | source = "registry+https://github.com/rust-lang/crates.io-index" 1464 | checksum = "3f611afe4d1407ebe7f3ced1ffc66f730fac1b1c13085e230a8cdcb921e97710" 1465 | dependencies = [ 1466 | "base64", 1467 | "byteorder", 1468 | "bytes", 1469 | "fallible-iterator", 1470 | "hmac", 1471 | "md5", 1472 | "memchr", 1473 | "rand", 1474 | "sha2", 1475 | "stringprep", 1476 | ] 1477 | 1478 | [[package]] 1479 | name = "postgres-types" 1480 | version = "0.1.1" 1481 | source = "registry+https://github.com/rust-lang/crates.io-index" 1482 | checksum = "e634590e8812c500088d88db721195979223dabb05149f43cb50931d0ff5865d" 1483 | dependencies = [ 1484 | "bytes", 1485 | "fallible-iterator", 1486 | "postgres-protocol", 1487 | ] 1488 | 1489 | [[package]] 1490 | name = "ppv-lite86" 1491 | version = "0.2.8" 1492 | source = "registry+https://github.com/rust-lang/crates.io-index" 1493 | checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea" 1494 | 1495 | [[package]] 1496 | name = "predicates" 1497 | version = "1.0.4" 1498 | source = "registry+https://github.com/rust-lang/crates.io-index" 1499 | checksum = "347a1b6f0b21e636bc9872fb60b83b8e185f6f5516298b8238699f7f9a531030" 1500 | dependencies = [ 1501 | "difference", 1502 | "float-cmp", 1503 | "normalize-line-endings", 1504 | "predicates-core", 1505 | "regex", 1506 | ] 1507 | 1508 | [[package]] 1509 | name = "predicates-core" 1510 | version = "1.0.0" 1511 | source = "registry+https://github.com/rust-lang/crates.io-index" 1512 | checksum = "06075c3a3e92559ff8929e7a280684489ea27fe44805174c3ebd9328dcb37178" 1513 | 1514 | [[package]] 1515 | name = "predicates-tree" 1516 | version = "1.0.0" 1517 | source = "registry+https://github.com/rust-lang/crates.io-index" 1518 | checksum = "8e63c4859013b38a76eca2414c64911fba30def9e3202ac461a2d22831220124" 1519 | dependencies = [ 1520 | "predicates-core", 1521 | "treeline", 1522 | ] 1523 | 1524 | [[package]] 1525 | name = "proc-macro-hack" 1526 | version = "0.5.16" 1527 | source = "registry+https://github.com/rust-lang/crates.io-index" 1528 | checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4" 1529 | 1530 | [[package]] 1531 | name = "proc-macro-nested" 1532 | version = "0.1.6" 1533 | source = "registry+https://github.com/rust-lang/crates.io-index" 1534 | checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" 1535 | 1536 | [[package]] 1537 | name = "proc-macro2" 1538 | version = "0.4.30" 1539 | source = "registry+https://github.com/rust-lang/crates.io-index" 1540 | checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" 1541 | dependencies = [ 1542 | "unicode-xid 0.1.0", 1543 | ] 1544 | 1545 | [[package]] 1546 | name = "proc-macro2" 1547 | version = "1.0.18" 1548 | source = "registry+https://github.com/rust-lang/crates.io-index" 1549 | checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" 1550 | dependencies = [ 1551 | "unicode-xid 0.2.1", 1552 | ] 1553 | 1554 | [[package]] 1555 | name = "quick-error" 1556 | version = "1.2.3" 1557 | source = "registry+https://github.com/rust-lang/crates.io-index" 1558 | checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" 1559 | 1560 | [[package]] 1561 | name = "quote" 1562 | version = "0.6.13" 1563 | source = "registry+https://github.com/rust-lang/crates.io-index" 1564 | checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" 1565 | dependencies = [ 1566 | "proc-macro2 0.4.30", 1567 | ] 1568 | 1569 | [[package]] 1570 | name = "quote" 1571 | version = "1.0.7" 1572 | source = "registry+https://github.com/rust-lang/crates.io-index" 1573 | checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" 1574 | dependencies = [ 1575 | "proc-macro2 1.0.18", 1576 | ] 1577 | 1578 | [[package]] 1579 | name = "rand" 1580 | version = "0.7.3" 1581 | source = "registry+https://github.com/rust-lang/crates.io-index" 1582 | checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" 1583 | dependencies = [ 1584 | "getrandom", 1585 | "libc", 1586 | "rand_chacha", 1587 | "rand_core", 1588 | "rand_hc", 1589 | ] 1590 | 1591 | [[package]] 1592 | name = "rand_chacha" 1593 | version = "0.2.2" 1594 | source = "registry+https://github.com/rust-lang/crates.io-index" 1595 | checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" 1596 | dependencies = [ 1597 | "ppv-lite86", 1598 | "rand_core", 1599 | ] 1600 | 1601 | [[package]] 1602 | name = "rand_core" 1603 | version = "0.5.1" 1604 | source = "registry+https://github.com/rust-lang/crates.io-index" 1605 | checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" 1606 | dependencies = [ 1607 | "getrandom", 1608 | ] 1609 | 1610 | [[package]] 1611 | name = "rand_hc" 1612 | version = "0.2.0" 1613 | source = "registry+https://github.com/rust-lang/crates.io-index" 1614 | checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" 1615 | dependencies = [ 1616 | "rand_core", 1617 | ] 1618 | 1619 | [[package]] 1620 | name = "redox_syscall" 1621 | version = "0.1.56" 1622 | source = "registry+https://github.com/rust-lang/crates.io-index" 1623 | checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" 1624 | 1625 | [[package]] 1626 | name = "refinery" 1627 | version = "0.2.1" 1628 | source = "registry+https://github.com/rust-lang/crates.io-index" 1629 | checksum = "a183a43ec19e875de78006daff5e2507967f182911ce643dcdd8ec0c1418317d" 1630 | dependencies = [ 1631 | "barrel", 1632 | "refinery-macros 0.2.0", 1633 | "refinery-migrations", 1634 | ] 1635 | 1636 | [[package]] 1637 | name = "refinery" 1638 | version = "0.3.0" 1639 | source = "registry+https://github.com/rust-lang/crates.io-index" 1640 | checksum = "432021bd2eb60a8851757fdd145907be1a96c70961da167a3fb362001f2f397c" 1641 | dependencies = [ 1642 | "refinery-core", 1643 | "refinery-macros 0.3.0", 1644 | ] 1645 | 1646 | [[package]] 1647 | name = "refinery-core" 1648 | version = "0.3.1" 1649 | source = "registry+https://github.com/rust-lang/crates.io-index" 1650 | checksum = "f9f670a4f4d6450ce53ecf0dd55324e0a3b684c24693e5cd68fdeca2294b875a" 1651 | dependencies = [ 1652 | "async-trait", 1653 | "cfg-if", 1654 | "chrono", 1655 | "lazy_static", 1656 | "log", 1657 | "postgres", 1658 | "regex", 1659 | "serde", 1660 | "siphasher", 1661 | "thiserror", 1662 | "toml", 1663 | "walkdir", 1664 | ] 1665 | 1666 | [[package]] 1667 | name = "refinery-macros" 1668 | version = "0.2.0" 1669 | source = "registry+https://github.com/rust-lang/crates.io-index" 1670 | checksum = "47d0263cb586a8895addc308120c0ea17704acc3fc1ba668332c37c6ec476fbb" 1671 | dependencies = [ 1672 | "barrel", 1673 | "lazy_static", 1674 | "log", 1675 | "proc-macro2 0.4.30", 1676 | "quote 0.6.13", 1677 | "refinery-migrations", 1678 | "syn 0.15.44", 1679 | ] 1680 | 1681 | [[package]] 1682 | name = "refinery-macros" 1683 | version = "0.3.0" 1684 | source = "registry+https://github.com/rust-lang/crates.io-index" 1685 | checksum = "f397c4dfbcf0b298e8b10e5702d69852829636ee121215c42efe421dd16126e1" 1686 | dependencies = [ 1687 | "proc-macro2 1.0.18", 1688 | "quote 1.0.7", 1689 | "refinery-core", 1690 | "regex", 1691 | "syn 1.0.33", 1692 | ] 1693 | 1694 | [[package]] 1695 | name = "refinery-migrations" 1696 | version = "0.2.2" 1697 | source = "registry+https://github.com/rust-lang/crates.io-index" 1698 | checksum = "ca8ee8f6d05c1ec851faae51f4db5449eb816b48ef93d03a932a45ee2332dc37" 1699 | dependencies = [ 1700 | "async-trait", 1701 | "cfg-if", 1702 | "chrono", 1703 | "lazy_static", 1704 | "log", 1705 | "postgres", 1706 | "regex", 1707 | "serde", 1708 | "thiserror", 1709 | "toml", 1710 | "walkdir", 1711 | ] 1712 | 1713 | [[package]] 1714 | name = "regex" 1715 | version = "1.3.9" 1716 | source = "registry+https://github.com/rust-lang/crates.io-index" 1717 | checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" 1718 | dependencies = [ 1719 | "aho-corasick", 1720 | "memchr", 1721 | "regex-syntax", 1722 | "thread_local", 1723 | ] 1724 | 1725 | [[package]] 1726 | name = "regex-syntax" 1727 | version = "0.6.18" 1728 | source = "registry+https://github.com/rust-lang/crates.io-index" 1729 | checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" 1730 | 1731 | [[package]] 1732 | name = "remove_dir_all" 1733 | version = "0.5.3" 1734 | source = "registry+https://github.com/rust-lang/crates.io-index" 1735 | checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" 1736 | dependencies = [ 1737 | "winapi 0.3.8", 1738 | ] 1739 | 1740 | [[package]] 1741 | name = "route-recognizer" 1742 | version = "0.1.13" 1743 | source = "registry+https://github.com/rust-lang/crates.io-index" 1744 | checksum = "ea509065eb0b3c446acdd0102f0d46567dc30902dc0be91d6552035d92b0f4f8" 1745 | 1746 | [[package]] 1747 | name = "rustc-demangle" 1748 | version = "0.1.16" 1749 | source = "registry+https://github.com/rust-lang/crates.io-index" 1750 | checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" 1751 | 1752 | [[package]] 1753 | name = "rustc_version" 1754 | version = "0.2.3" 1755 | source = "registry+https://github.com/rust-lang/crates.io-index" 1756 | checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" 1757 | dependencies = [ 1758 | "semver", 1759 | ] 1760 | 1761 | [[package]] 1762 | name = "ryu" 1763 | version = "1.0.5" 1764 | source = "registry+https://github.com/rust-lang/crates.io-index" 1765 | checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" 1766 | 1767 | [[package]] 1768 | name = "same-file" 1769 | version = "1.0.6" 1770 | source = "registry+https://github.com/rust-lang/crates.io-index" 1771 | checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" 1772 | dependencies = [ 1773 | "winapi-util", 1774 | ] 1775 | 1776 | [[package]] 1777 | name = "schannel" 1778 | version = "0.1.19" 1779 | source = "registry+https://github.com/rust-lang/crates.io-index" 1780 | checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" 1781 | dependencies = [ 1782 | "lazy_static", 1783 | "winapi 0.3.8", 1784 | ] 1785 | 1786 | [[package]] 1787 | name = "scoped-tls" 1788 | version = "0.1.2" 1789 | source = "registry+https://github.com/rust-lang/crates.io-index" 1790 | checksum = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" 1791 | 1792 | [[package]] 1793 | name = "scoped-tls" 1794 | version = "1.0.0" 1795 | source = "registry+https://github.com/rust-lang/crates.io-index" 1796 | checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" 1797 | 1798 | [[package]] 1799 | name = "scopeguard" 1800 | version = "1.1.0" 1801 | source = "registry+https://github.com/rust-lang/crates.io-index" 1802 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 1803 | 1804 | [[package]] 1805 | name = "security-framework" 1806 | version = "0.4.4" 1807 | source = "registry+https://github.com/rust-lang/crates.io-index" 1808 | checksum = "64808902d7d99f78eaddd2b4e2509713babc3dc3c85ad6f4c447680f3c01e535" 1809 | dependencies = [ 1810 | "bitflags", 1811 | "core-foundation", 1812 | "core-foundation-sys", 1813 | "libc", 1814 | "security-framework-sys", 1815 | ] 1816 | 1817 | [[package]] 1818 | name = "security-framework-sys" 1819 | version = "0.4.3" 1820 | source = "registry+https://github.com/rust-lang/crates.io-index" 1821 | checksum = "17bf11d99252f512695eb468de5516e5cf75455521e69dfe343f3b74e4748405" 1822 | dependencies = [ 1823 | "core-foundation-sys", 1824 | "libc", 1825 | ] 1826 | 1827 | [[package]] 1828 | name = "semver" 1829 | version = "0.9.0" 1830 | source = "registry+https://github.com/rust-lang/crates.io-index" 1831 | checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" 1832 | dependencies = [ 1833 | "semver-parser", 1834 | ] 1835 | 1836 | [[package]] 1837 | name = "semver-parser" 1838 | version = "0.7.0" 1839 | source = "registry+https://github.com/rust-lang/crates.io-index" 1840 | checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" 1841 | 1842 | [[package]] 1843 | name = "send_wrapper" 1844 | version = "0.4.0" 1845 | source = "registry+https://github.com/rust-lang/crates.io-index" 1846 | checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" 1847 | 1848 | [[package]] 1849 | name = "serde" 1850 | version = "1.0.114" 1851 | source = "registry+https://github.com/rust-lang/crates.io-index" 1852 | checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3" 1853 | dependencies = [ 1854 | "serde_derive", 1855 | ] 1856 | 1857 | [[package]] 1858 | name = "serde_derive" 1859 | version = "1.0.114" 1860 | source = "registry+https://github.com/rust-lang/crates.io-index" 1861 | checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e" 1862 | dependencies = [ 1863 | "proc-macro2 1.0.18", 1864 | "quote 1.0.7", 1865 | "syn 1.0.33", 1866 | ] 1867 | 1868 | [[package]] 1869 | name = "serde_json" 1870 | version = "1.0.55" 1871 | source = "registry+https://github.com/rust-lang/crates.io-index" 1872 | checksum = "ec2c5d7e739bc07a3e73381a39d61fdb5f671c60c1df26a130690665803d8226" 1873 | dependencies = [ 1874 | "itoa", 1875 | "ryu", 1876 | "serde", 1877 | ] 1878 | 1879 | [[package]] 1880 | name = "serde_qs" 1881 | version = "0.6.1" 1882 | source = "registry+https://github.com/rust-lang/crates.io-index" 1883 | checksum = "c6f3acf84e23ab27c01cb5917551765c01c50b2000089db8fa47fe018a3260cf" 1884 | dependencies = [ 1885 | "data-encoding", 1886 | "error-chain", 1887 | "percent-encoding", 1888 | "serde", 1889 | ] 1890 | 1891 | [[package]] 1892 | name = "serde_urlencoded" 1893 | version = "0.6.1" 1894 | source = "registry+https://github.com/rust-lang/crates.io-index" 1895 | checksum = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" 1896 | dependencies = [ 1897 | "dtoa", 1898 | "itoa", 1899 | "serde", 1900 | "url", 1901 | ] 1902 | 1903 | [[package]] 1904 | name = "sha-1" 1905 | version = "0.8.2" 1906 | source = "registry+https://github.com/rust-lang/crates.io-index" 1907 | checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" 1908 | dependencies = [ 1909 | "block-buffer", 1910 | "digest", 1911 | "fake-simd", 1912 | "opaque-debug", 1913 | ] 1914 | 1915 | [[package]] 1916 | name = "sha1" 1917 | version = "0.6.0" 1918 | source = "registry+https://github.com/rust-lang/crates.io-index" 1919 | checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" 1920 | 1921 | [[package]] 1922 | name = "sha2" 1923 | version = "0.8.2" 1924 | source = "registry+https://github.com/rust-lang/crates.io-index" 1925 | checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" 1926 | dependencies = [ 1927 | "block-buffer", 1928 | "digest", 1929 | "fake-simd", 1930 | "opaque-debug", 1931 | ] 1932 | 1933 | [[package]] 1934 | name = "siphasher" 1935 | version = "0.3.3" 1936 | source = "registry+https://github.com/rust-lang/crates.io-index" 1937 | checksum = "fa8f3741c7372e75519bd9346068370c9cdaabcc1f9599cbcf2a2719352286b7" 1938 | 1939 | [[package]] 1940 | name = "slab" 1941 | version = "0.4.2" 1942 | source = "registry+https://github.com/rust-lang/crates.io-index" 1943 | checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" 1944 | 1945 | [[package]] 1946 | name = "smallvec" 1947 | version = "1.4.0" 1948 | source = "registry+https://github.com/rust-lang/crates.io-index" 1949 | checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4" 1950 | 1951 | [[package]] 1952 | name = "smol" 1953 | version = "0.1.18" 1954 | source = "registry+https://github.com/rust-lang/crates.io-index" 1955 | checksum = "620cbb3c6e34da57d3a248cda0cd01cd5848164dc062e764e65d06fe3ea7aed5" 1956 | dependencies = [ 1957 | "async-task", 1958 | "blocking", 1959 | "concurrent-queue", 1960 | "fastrand", 1961 | "futures-io", 1962 | "futures-util", 1963 | "libc", 1964 | "once_cell", 1965 | "scoped-tls 1.0.0", 1966 | "slab", 1967 | "socket2", 1968 | "wepoll-sys-stjepang", 1969 | "winapi 0.3.8", 1970 | ] 1971 | 1972 | [[package]] 1973 | name = "socket2" 1974 | version = "0.3.12" 1975 | source = "registry+https://github.com/rust-lang/crates.io-index" 1976 | checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918" 1977 | dependencies = [ 1978 | "cfg-if", 1979 | "libc", 1980 | "redox_syscall", 1981 | "winapi 0.3.8", 1982 | ] 1983 | 1984 | [[package]] 1985 | name = "sql-builder" 1986 | version = "0.12.2" 1987 | source = "registry+https://github.com/rust-lang/crates.io-index" 1988 | checksum = "b71acc5206311bbcff3affed2b6dccc13c030ae7710aa23c027fb3605cf05563" 1989 | 1990 | [[package]] 1991 | name = "sqlformat" 1992 | version = "0.1.0" 1993 | source = "registry+https://github.com/rust-lang/crates.io-index" 1994 | checksum = "5ce64a4576e1720a2e511bf3ccdb8c0f6cfed0fc265bcbaa0bd369485e02c631" 1995 | dependencies = [ 1996 | "lazy_static", 1997 | "maplit", 1998 | "regex", 1999 | ] 2000 | 2001 | [[package]] 2002 | name = "sqlx" 2003 | version = "0.3.5" 2004 | source = "registry+https://github.com/rust-lang/crates.io-index" 2005 | checksum = "8974cacd80085fbe49e778708d660dec6fb351604dc34c3905b26efb2803b038" 2006 | dependencies = [ 2007 | "sqlx-core", 2008 | "sqlx-macros", 2009 | ] 2010 | 2011 | [[package]] 2012 | name = "sqlx-core" 2013 | version = "0.3.5" 2014 | source = "registry+https://github.com/rust-lang/crates.io-index" 2015 | checksum = "88ac5a436f941c42eac509471a730df5c3c58e1450e68cd39afedbd948206273" 2016 | dependencies = [ 2017 | "async-native-tls", 2018 | "async-std", 2019 | "async-stream", 2020 | "base64", 2021 | "bitflags", 2022 | "byteorder", 2023 | "crossbeam-queue", 2024 | "crossbeam-utils", 2025 | "futures-channel", 2026 | "futures-core", 2027 | "futures-util", 2028 | "hex", 2029 | "hmac", 2030 | "libc", 2031 | "log", 2032 | "md-5", 2033 | "memchr", 2034 | "percent-encoding", 2035 | "rand", 2036 | "sha-1", 2037 | "sha2", 2038 | "sqlformat", 2039 | "tokio", 2040 | "url", 2041 | ] 2042 | 2043 | [[package]] 2044 | name = "sqlx-macros" 2045 | version = "0.3.5" 2046 | source = "registry+https://github.com/rust-lang/crates.io-index" 2047 | checksum = "de2ae78b783af5922d811b14665a5a3755e531c3087bb805cf24cf71f15e6780" 2048 | dependencies = [ 2049 | "async-std", 2050 | "dotenv", 2051 | "futures", 2052 | "heck", 2053 | "proc-macro2 1.0.18", 2054 | "quote 1.0.7", 2055 | "sqlx-core", 2056 | "syn 1.0.33", 2057 | "url", 2058 | ] 2059 | 2060 | [[package]] 2061 | name = "stable_deref_trait" 2062 | version = "1.1.1" 2063 | source = "registry+https://github.com/rust-lang/crates.io-index" 2064 | checksum = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" 2065 | 2066 | [[package]] 2067 | name = "standback" 2068 | version = "0.2.9" 2069 | source = "registry+https://github.com/rust-lang/crates.io-index" 2070 | checksum = "b0437cfb83762844799a60e1e3b489d5ceb6a650fbacb86437badc1b6d87b246" 2071 | dependencies = [ 2072 | "version_check", 2073 | ] 2074 | 2075 | [[package]] 2076 | name = "stdweb" 2077 | version = "0.4.20" 2078 | source = "registry+https://github.com/rust-lang/crates.io-index" 2079 | checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" 2080 | dependencies = [ 2081 | "discard", 2082 | "rustc_version", 2083 | "stdweb-derive", 2084 | "stdweb-internal-macros", 2085 | "stdweb-internal-runtime", 2086 | "wasm-bindgen", 2087 | ] 2088 | 2089 | [[package]] 2090 | name = "stdweb-derive" 2091 | version = "0.5.3" 2092 | source = "registry+https://github.com/rust-lang/crates.io-index" 2093 | checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" 2094 | dependencies = [ 2095 | "proc-macro2 1.0.18", 2096 | "quote 1.0.7", 2097 | "serde", 2098 | "serde_derive", 2099 | "syn 1.0.33", 2100 | ] 2101 | 2102 | [[package]] 2103 | name = "stdweb-internal-macros" 2104 | version = "0.2.9" 2105 | source = "registry+https://github.com/rust-lang/crates.io-index" 2106 | checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" 2107 | dependencies = [ 2108 | "base-x", 2109 | "proc-macro2 1.0.18", 2110 | "quote 1.0.7", 2111 | "serde", 2112 | "serde_derive", 2113 | "serde_json", 2114 | "sha1", 2115 | "syn 1.0.33", 2116 | ] 2117 | 2118 | [[package]] 2119 | name = "stdweb-internal-runtime" 2120 | version = "0.1.5" 2121 | source = "registry+https://github.com/rust-lang/crates.io-index" 2122 | checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" 2123 | 2124 | [[package]] 2125 | name = "stringprep" 2126 | version = "0.1.2" 2127 | source = "registry+https://github.com/rust-lang/crates.io-index" 2128 | checksum = "8ee348cb74b87454fff4b551cbf727025810a004f88aeacae7f85b87f4e9a1c1" 2129 | dependencies = [ 2130 | "unicode-bidi", 2131 | "unicode-normalization", 2132 | ] 2133 | 2134 | [[package]] 2135 | name = "subtle" 2136 | version = "1.0.0" 2137 | source = "registry+https://github.com/rust-lang/crates.io-index" 2138 | checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" 2139 | 2140 | [[package]] 2141 | name = "subtle" 2142 | version = "2.2.3" 2143 | source = "registry+https://github.com/rust-lang/crates.io-index" 2144 | checksum = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1" 2145 | 2146 | [[package]] 2147 | name = "syn" 2148 | version = "0.15.44" 2149 | source = "registry+https://github.com/rust-lang/crates.io-index" 2150 | checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" 2151 | dependencies = [ 2152 | "proc-macro2 0.4.30", 2153 | "quote 0.6.13", 2154 | "unicode-xid 0.1.0", 2155 | ] 2156 | 2157 | [[package]] 2158 | name = "syn" 2159 | version = "1.0.33" 2160 | source = "registry+https://github.com/rust-lang/crates.io-index" 2161 | checksum = "e8d5d96e8cbb005d6959f119f773bfaebb5684296108fb32600c00cde305b2cd" 2162 | dependencies = [ 2163 | "proc-macro2 1.0.18", 2164 | "quote 1.0.7", 2165 | "unicode-xid 0.2.1", 2166 | ] 2167 | 2168 | [[package]] 2169 | name = "tempfile" 2170 | version = "3.1.0" 2171 | source = "registry+https://github.com/rust-lang/crates.io-index" 2172 | checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" 2173 | dependencies = [ 2174 | "cfg-if", 2175 | "libc", 2176 | "rand", 2177 | "redox_syscall", 2178 | "remove_dir_all", 2179 | "winapi 0.3.8", 2180 | ] 2181 | 2182 | [[package]] 2183 | name = "termcolor" 2184 | version = "1.1.0" 2185 | source = "registry+https://github.com/rust-lang/crates.io-index" 2186 | checksum = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f" 2187 | dependencies = [ 2188 | "winapi-util", 2189 | ] 2190 | 2191 | [[package]] 2192 | name = "termios" 2193 | version = "0.3.2" 2194 | source = "registry+https://github.com/rust-lang/crates.io-index" 2195 | checksum = "6f0fcee7b24a25675de40d5bb4de6e41b0df07bc9856295e7e2b3a3600c400c2" 2196 | dependencies = [ 2197 | "libc", 2198 | ] 2199 | 2200 | [[package]] 2201 | name = "thiserror" 2202 | version = "1.0.20" 2203 | source = "registry+https://github.com/rust-lang/crates.io-index" 2204 | checksum = "7dfdd070ccd8ccb78f4ad66bf1982dc37f620ef696c6b5028fe2ed83dd3d0d08" 2205 | dependencies = [ 2206 | "thiserror-impl", 2207 | ] 2208 | 2209 | [[package]] 2210 | name = "thiserror-impl" 2211 | version = "1.0.20" 2212 | source = "registry+https://github.com/rust-lang/crates.io-index" 2213 | checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" 2214 | dependencies = [ 2215 | "proc-macro2 1.0.18", 2216 | "quote 1.0.7", 2217 | "syn 1.0.33", 2218 | ] 2219 | 2220 | [[package]] 2221 | name = "thread_local" 2222 | version = "1.0.1" 2223 | source = "registry+https://github.com/rust-lang/crates.io-index" 2224 | checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" 2225 | dependencies = [ 2226 | "lazy_static", 2227 | ] 2228 | 2229 | [[package]] 2230 | name = "tide" 2231 | version = "0.11.0" 2232 | source = "registry+https://github.com/rust-lang/crates.io-index" 2233 | checksum = "151b07f369a9152c2f93715ea0db8a7f7e2533bd2e52fbff1ea5bad7a88db541" 2234 | dependencies = [ 2235 | "async-h1", 2236 | "async-sse", 2237 | "async-std", 2238 | "femme 2.1.0", 2239 | "http-types", 2240 | "kv-log-macro", 2241 | "route-recognizer", 2242 | "serde", 2243 | "serde_json", 2244 | ] 2245 | 2246 | [[package]] 2247 | name = "time" 2248 | version = "0.1.43" 2249 | source = "registry+https://github.com/rust-lang/crates.io-index" 2250 | checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" 2251 | dependencies = [ 2252 | "libc", 2253 | "winapi 0.3.8", 2254 | ] 2255 | 2256 | [[package]] 2257 | name = "time" 2258 | version = "0.2.16" 2259 | source = "registry+https://github.com/rust-lang/crates.io-index" 2260 | checksum = "3a51cadc5b1eec673a685ff7c33192ff7b7603d0b75446fb354939ee615acb15" 2261 | dependencies = [ 2262 | "cfg-if", 2263 | "libc", 2264 | "standback", 2265 | "stdweb", 2266 | "time-macros", 2267 | "version_check", 2268 | "winapi 0.3.8", 2269 | ] 2270 | 2271 | [[package]] 2272 | name = "time-macros" 2273 | version = "0.1.0" 2274 | source = "registry+https://github.com/rust-lang/crates.io-index" 2275 | checksum = "9ae9b6e9f095bc105e183e3cd493d72579be3181ad4004fceb01adbe9eecab2d" 2276 | dependencies = [ 2277 | "proc-macro-hack", 2278 | "time-macros-impl", 2279 | ] 2280 | 2281 | [[package]] 2282 | name = "time-macros-impl" 2283 | version = "0.1.1" 2284 | source = "registry+https://github.com/rust-lang/crates.io-index" 2285 | checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa" 2286 | dependencies = [ 2287 | "proc-macro-hack", 2288 | "proc-macro2 1.0.18", 2289 | "quote 1.0.7", 2290 | "standback", 2291 | "syn 1.0.33", 2292 | ] 2293 | 2294 | [[package]] 2295 | name = "tinyvec" 2296 | version = "0.3.3" 2297 | source = "registry+https://github.com/rust-lang/crates.io-index" 2298 | checksum = "53953d2d3a5ad81d9f844a32f14ebb121f50b650cd59d0ee2a07cf13c617efed" 2299 | 2300 | [[package]] 2301 | name = "tokio" 2302 | version = "0.2.21" 2303 | source = "registry+https://github.com/rust-lang/crates.io-index" 2304 | checksum = "d099fa27b9702bed751524694adbe393e18b36b204da91eb1cbbbbb4a5ee2d58" 2305 | dependencies = [ 2306 | "bytes", 2307 | "futures-core", 2308 | "iovec", 2309 | "lazy_static", 2310 | "libc", 2311 | "memchr", 2312 | "mio", 2313 | "mio-uds", 2314 | "pin-project-lite", 2315 | "slab", 2316 | ] 2317 | 2318 | [[package]] 2319 | name = "tokio-postgres" 2320 | version = "0.5.4" 2321 | source = "registry+https://github.com/rust-lang/crates.io-index" 2322 | checksum = "d56010a704311361b7c9e870aaa4ddffaf9f2db89cbcf3e14773ac8a14469c9c" 2323 | dependencies = [ 2324 | "async-trait", 2325 | "byteorder", 2326 | "bytes", 2327 | "fallible-iterator", 2328 | "futures", 2329 | "log", 2330 | "parking_lot 0.10.2", 2331 | "percent-encoding", 2332 | "phf", 2333 | "pin-project-lite", 2334 | "postgres-protocol", 2335 | "postgres-types", 2336 | "tokio", 2337 | "tokio-util", 2338 | ] 2339 | 2340 | [[package]] 2341 | name = "tokio-util" 2342 | version = "0.3.1" 2343 | source = "registry+https://github.com/rust-lang/crates.io-index" 2344 | checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" 2345 | dependencies = [ 2346 | "bytes", 2347 | "futures-core", 2348 | "futures-sink", 2349 | "log", 2350 | "pin-project-lite", 2351 | "tokio", 2352 | ] 2353 | 2354 | [[package]] 2355 | name = "toml" 2356 | version = "0.5.6" 2357 | source = "registry+https://github.com/rust-lang/crates.io-index" 2358 | checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" 2359 | dependencies = [ 2360 | "serde", 2361 | ] 2362 | 2363 | [[package]] 2364 | name = "treeline" 2365 | version = "0.1.0" 2366 | source = "registry+https://github.com/rust-lang/crates.io-index" 2367 | checksum = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41" 2368 | 2369 | [[package]] 2370 | name = "typenum" 2371 | version = "1.12.0" 2372 | source = "registry+https://github.com/rust-lang/crates.io-index" 2373 | checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" 2374 | 2375 | [[package]] 2376 | name = "unicode-bidi" 2377 | version = "0.3.4" 2378 | source = "registry+https://github.com/rust-lang/crates.io-index" 2379 | checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" 2380 | dependencies = [ 2381 | "matches", 2382 | ] 2383 | 2384 | [[package]] 2385 | name = "unicode-normalization" 2386 | version = "0.1.13" 2387 | source = "registry+https://github.com/rust-lang/crates.io-index" 2388 | checksum = "6fb19cf769fa8c6a80a162df694621ebeb4dafb606470b2b2fce0be40a98a977" 2389 | dependencies = [ 2390 | "tinyvec", 2391 | ] 2392 | 2393 | [[package]] 2394 | name = "unicode-segmentation" 2395 | version = "1.6.0" 2396 | source = "registry+https://github.com/rust-lang/crates.io-index" 2397 | checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" 2398 | 2399 | [[package]] 2400 | name = "unicode-width" 2401 | version = "0.1.7" 2402 | source = "registry+https://github.com/rust-lang/crates.io-index" 2403 | checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" 2404 | 2405 | [[package]] 2406 | name = "unicode-xid" 2407 | version = "0.1.0" 2408 | source = "registry+https://github.com/rust-lang/crates.io-index" 2409 | checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" 2410 | 2411 | [[package]] 2412 | name = "unicode-xid" 2413 | version = "0.2.1" 2414 | source = "registry+https://github.com/rust-lang/crates.io-index" 2415 | checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" 2416 | 2417 | [[package]] 2418 | name = "universal-hash" 2419 | version = "0.3.0" 2420 | source = "registry+https://github.com/rust-lang/crates.io-index" 2421 | checksum = "df0c900f2f9b4116803415878ff48b63da9edb268668e08cf9292d7503114a01" 2422 | dependencies = [ 2423 | "generic-array", 2424 | "subtle 2.2.3", 2425 | ] 2426 | 2427 | [[package]] 2428 | name = "url" 2429 | version = "2.1.1" 2430 | source = "registry+https://github.com/rust-lang/crates.io-index" 2431 | checksum = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" 2432 | dependencies = [ 2433 | "idna", 2434 | "matches", 2435 | "percent-encoding", 2436 | ] 2437 | 2438 | [[package]] 2439 | name = "vcpkg" 2440 | version = "0.2.10" 2441 | source = "registry+https://github.com/rust-lang/crates.io-index" 2442 | checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c" 2443 | 2444 | [[package]] 2445 | name = "version_check" 2446 | version = "0.9.2" 2447 | source = "registry+https://github.com/rust-lang/crates.io-index" 2448 | checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" 2449 | 2450 | [[package]] 2451 | name = "waker-fn" 2452 | version = "1.0.0" 2453 | source = "registry+https://github.com/rust-lang/crates.io-index" 2454 | checksum = "9571542c2ce85ce642e6b58b3364da2fb53526360dfb7c211add4f5c23105ff7" 2455 | 2456 | [[package]] 2457 | name = "walkdir" 2458 | version = "2.3.1" 2459 | source = "registry+https://github.com/rust-lang/crates.io-index" 2460 | checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" 2461 | dependencies = [ 2462 | "same-file", 2463 | "winapi 0.3.8", 2464 | "winapi-util", 2465 | ] 2466 | 2467 | [[package]] 2468 | name = "wasi" 2469 | version = "0.9.0+wasi-snapshot-preview1" 2470 | source = "registry+https://github.com/rust-lang/crates.io-index" 2471 | checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" 2472 | 2473 | [[package]] 2474 | name = "wasm-bindgen" 2475 | version = "0.2.63" 2476 | source = "registry+https://github.com/rust-lang/crates.io-index" 2477 | checksum = "4c2dc4aa152834bc334f506c1a06b866416a8b6697d5c9f75b9a689c8486def0" 2478 | dependencies = [ 2479 | "cfg-if", 2480 | "serde", 2481 | "serde_json", 2482 | "wasm-bindgen-macro", 2483 | ] 2484 | 2485 | [[package]] 2486 | name = "wasm-bindgen-backend" 2487 | version = "0.2.63" 2488 | source = "registry+https://github.com/rust-lang/crates.io-index" 2489 | checksum = "ded84f06e0ed21499f6184df0e0cb3494727b0c5da89534e0fcc55c51d812101" 2490 | dependencies = [ 2491 | "bumpalo", 2492 | "lazy_static", 2493 | "log", 2494 | "proc-macro2 1.0.18", 2495 | "quote 1.0.7", 2496 | "syn 1.0.33", 2497 | "wasm-bindgen-shared", 2498 | ] 2499 | 2500 | [[package]] 2501 | name = "wasm-bindgen-futures" 2502 | version = "0.4.13" 2503 | source = "registry+https://github.com/rust-lang/crates.io-index" 2504 | checksum = "64487204d863f109eb77e8462189d111f27cb5712cc9fdb3461297a76963a2f6" 2505 | dependencies = [ 2506 | "cfg-if", 2507 | "js-sys", 2508 | "wasm-bindgen", 2509 | "web-sys", 2510 | ] 2511 | 2512 | [[package]] 2513 | name = "wasm-bindgen-macro" 2514 | version = "0.2.63" 2515 | source = "registry+https://github.com/rust-lang/crates.io-index" 2516 | checksum = "838e423688dac18d73e31edce74ddfac468e37b1506ad163ffaf0a46f703ffe3" 2517 | dependencies = [ 2518 | "quote 1.0.7", 2519 | "wasm-bindgen-macro-support", 2520 | ] 2521 | 2522 | [[package]] 2523 | name = "wasm-bindgen-macro-support" 2524 | version = "0.2.63" 2525 | source = "registry+https://github.com/rust-lang/crates.io-index" 2526 | checksum = "3156052d8ec77142051a533cdd686cba889537b213f948cd1d20869926e68e92" 2527 | dependencies = [ 2528 | "proc-macro2 1.0.18", 2529 | "quote 1.0.7", 2530 | "syn 1.0.33", 2531 | "wasm-bindgen-backend", 2532 | "wasm-bindgen-shared", 2533 | ] 2534 | 2535 | [[package]] 2536 | name = "wasm-bindgen-shared" 2537 | version = "0.2.63" 2538 | source = "registry+https://github.com/rust-lang/crates.io-index" 2539 | checksum = "c9ba19973a58daf4db6f352eda73dc0e289493cd29fb2632eb172085b6521acd" 2540 | 2541 | [[package]] 2542 | name = "web-sys" 2543 | version = "0.3.40" 2544 | source = "registry+https://github.com/rust-lang/crates.io-index" 2545 | checksum = "7b72fe77fd39e4bd3eaa4412fd299a0be6b3dfe9d2597e2f1c20beb968f41d17" 2546 | dependencies = [ 2547 | "js-sys", 2548 | "wasm-bindgen", 2549 | ] 2550 | 2551 | [[package]] 2552 | name = "wepoll-sys-stjepang" 2553 | version = "1.0.6" 2554 | source = "registry+https://github.com/rust-lang/crates.io-index" 2555 | checksum = "6fd319e971980166b53e17b1026812ad66c6b54063be879eb182342b55284694" 2556 | dependencies = [ 2557 | "cc", 2558 | ] 2559 | 2560 | [[package]] 2561 | name = "winapi" 2562 | version = "0.2.8" 2563 | source = "registry+https://github.com/rust-lang/crates.io-index" 2564 | checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" 2565 | 2566 | [[package]] 2567 | name = "winapi" 2568 | version = "0.3.8" 2569 | source = "registry+https://github.com/rust-lang/crates.io-index" 2570 | checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" 2571 | dependencies = [ 2572 | "winapi-i686-pc-windows-gnu", 2573 | "winapi-x86_64-pc-windows-gnu", 2574 | ] 2575 | 2576 | [[package]] 2577 | name = "winapi-build" 2578 | version = "0.1.1" 2579 | source = "registry+https://github.com/rust-lang/crates.io-index" 2580 | checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" 2581 | 2582 | [[package]] 2583 | name = "winapi-i686-pc-windows-gnu" 2584 | version = "0.4.0" 2585 | source = "registry+https://github.com/rust-lang/crates.io-index" 2586 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 2587 | 2588 | [[package]] 2589 | name = "winapi-util" 2590 | version = "0.1.5" 2591 | source = "registry+https://github.com/rust-lang/crates.io-index" 2592 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" 2593 | dependencies = [ 2594 | "winapi 0.3.8", 2595 | ] 2596 | 2597 | [[package]] 2598 | name = "winapi-x86_64-pc-windows-gnu" 2599 | version = "0.4.0" 2600 | source = "registry+https://github.com/rust-lang/crates.io-index" 2601 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 2602 | 2603 | [[package]] 2604 | name = "ws2_32-sys" 2605 | version = "0.2.1" 2606 | source = "registry+https://github.com/rust-lang/crates.io-index" 2607 | checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" 2608 | dependencies = [ 2609 | "winapi 0.2.8", 2610 | "winapi-build", 2611 | ] 2612 | 2613 | [[package]] 2614 | name = "zeroize" 2615 | version = "1.1.0" 2616 | source = "registry+https://github.com/rust-lang/crates.io-index" 2617 | checksum = "3cbac2ed2ba24cc90f5e06485ac8c7c1e5449fe8911aef4d8877218af021a5b8" 2618 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = [ 3 | "api", 4 | "models", 5 | "database" 6 | ] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # example-rust-api 2 | 3 | This is an example Rust REST API using [Tide](https://github.com/http-rs/tide) and [SQLX](https://github.com/launchbadge/sqlx). 4 | 5 | To run you must have rust installed. 6 | 7 | 1. Run `docker-compose up` to start Postgres database 8 | 2. Use `cargo run` to start API 9 | 3. Make a POST request to `http://localhost:8181/pet` with a request body (shown below) to add a pet 10 | 4. Make a GET request to `http://localhost:8181/pets` to get a list of pets 11 | 5. Make a GET request to `http://localhost:8181/pet/:id` to get an individual pet 12 | 13 | Example request body to add a pet (an additional tag field is optional) 14 | ```json 15 | { 16 | "id": 1, 17 | "name": "Ben" 18 | } 19 | ``` 20 | 21 | Make a GET request to `http://localhost:8181/oas` for the full API schema 22 | 23 | Use `cargo test` to run tests 24 | 25 | ![](https://pbs.twimg.com/media/CVwvDn5UkAAlne_?format=png&name=900x900) 26 | -------------------------------------------------------------------------------- /api/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobbinma/example-rust-api/f276982707bf7c781ab050fcf1a8ecc42418bee4/api/.DS_Store -------------------------------------------------------------------------------- /api/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-rust-api" 3 | version = "0.1.0" 4 | authors = ["matthewcobbing "] 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 | models = { path = "../models" } 11 | database = { path = "../database" } 12 | dotenv = "0.15.0" 13 | tide = "0.11.0" 14 | async-std = { version = "1.5.0", features = ["attributes"] } 15 | refinery = { version = "0.2.1", features = ["postgres"]} 16 | postgres = "0.17.3" 17 | env_logger = "0.7.1" 18 | femme = "1.3.0" 19 | log = "0.4.8" 20 | serde = "1.0.110" 21 | serde_derive = "1.0.110" 22 | mockall = "0.7.1" 23 | async-trait = "0.1.36" 24 | http-types = "2.2.1" 25 | serde_json = "1.0.55" -------------------------------------------------------------------------------- /api/src/error_response.rs: -------------------------------------------------------------------------------- 1 | use database::db_error::DatabaseError; 2 | use std::io::Error as IOError; 3 | use std::num::ParseIntError; 4 | 5 | #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] 6 | #[serde(rename_all = "camelCase")] 7 | pub struct ErrorResponse { 8 | pub code: i64, 9 | pub message: String, 10 | } 11 | 12 | impl From for ErrorResponse { 13 | fn from(item: DatabaseError) -> Self { 14 | ErrorResponse { 15 | code: 1, 16 | message: format!("{} : {}", "database returned error", item.detail()), 17 | } 18 | } 19 | } 20 | 21 | impl From for ErrorResponse { 22 | fn from(item: ParseIntError) -> Self { 23 | ErrorResponse { 24 | code: 2, 25 | message: format!("{} : {}", "integer parsing error", item.to_string()), 26 | } 27 | } 28 | } 29 | 30 | impl From for ErrorResponse { 31 | fn from(item: IOError) -> Self { 32 | ErrorResponse { 33 | code: 3, 34 | message: format!("{} : {}", "error parsing json body", item.to_string()), 35 | } 36 | } 37 | } 38 | 39 | impl From> for ErrorResponse { 40 | fn from(item: Box) -> Self { 41 | ErrorResponse { 42 | code: 3, 43 | message: format!("{} : {}", "error parsing json body", item.to_string()), 44 | } 45 | } 46 | } 47 | 48 | impl From for ErrorResponse { 49 | fn from(item: http_types::Error) -> Self { 50 | ErrorResponse { 51 | code: 3, 52 | message: format!("{} : {}", "error parsing json body", item.to_string()), 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /api/src/handlers.rs: -------------------------------------------------------------------------------- 1 | use log::{trace, warn}; 2 | use models::pet::Pet; 3 | use tide::{Body, Request, Response, StatusCode}; 4 | 5 | use crate::error_response::ErrorResponse; 6 | use crate::state::State; 7 | 8 | pub(crate) async fn get_pet(req: Request) -> tide::Result { 9 | let id: i32 = match req.param("id") { 10 | Ok(id) => id, 11 | Err(e) => { 12 | trace!("Bad Request: {:?}", e); 13 | let mut res = Response::new(StatusCode::BadRequest); 14 | res.set_body(Body::from_json(&ErrorResponse::from(e))?); 15 | return Ok(res); 16 | } 17 | }; 18 | 19 | match req.state().db().get_pet(id).await { 20 | Ok(pet) => { 21 | let mut res = Response::new(StatusCode::Ok); 22 | res.set_body(Body::from_json(&pet)?); 23 | Ok(res) 24 | } 25 | Err(e) => { 26 | warn!("Error getting pet from database: {:?}", e); 27 | let mut res = Response::new(StatusCode::InternalServerError); 28 | res.set_body(Body::from_json(&ErrorResponse::from(e))?); 29 | Ok(res) 30 | } 31 | } 32 | } 33 | 34 | pub(crate) async fn get_pets(req: Request) -> tide::Result { 35 | match req.state().db().find_all().await { 36 | Ok(pets) => { 37 | let mut res = Response::new(StatusCode::Ok); 38 | res.set_body(Body::from_json(&pets)?); 39 | Ok(res) 40 | } 41 | Err(e) => { 42 | warn!("Error getting pets from database: {:?}", e); 43 | let mut res = Response::new(StatusCode::InternalServerError); 44 | res.set_body(Body::from_json(&ErrorResponse::from(e))?); 45 | Ok(res) 46 | } 47 | } 48 | } 49 | 50 | pub(crate) async fn create_pet(mut req: Request) -> tide::Result { 51 | let pet: Pet = match req.body_json().await { 52 | Ok(pet) => pet, 53 | Err(e) => { 54 | trace!("Bad Request: {:?}", e); 55 | let mut res = Response::new(StatusCode::BadRequest); 56 | res.set_body(Body::from_json(&ErrorResponse::from(e))?); 57 | return Ok(res); 58 | } 59 | }; 60 | 61 | match req.state().db().create_pet(&pet).await { 62 | Ok(()) => Ok(Response::new(StatusCode::Created)), 63 | Err(e) => { 64 | warn!("Error creating pet from database: {:?}", e); 65 | let mut res = Response::new(StatusCode::InternalServerError); 66 | res.set_body(Body::from_json(&ErrorResponse::from(e))?); 67 | Ok(res) 68 | } 69 | } 70 | } 71 | 72 | #[cfg(test)] 73 | mod tests { 74 | use async_trait::async_trait; 75 | use http_types::Url; 76 | use mockall::predicate::*; 77 | use mockall::*; 78 | use models::pet::Pet; 79 | use models::repository::Repository; 80 | use serde_json::json; 81 | use std::error::Error; 82 | use tide::Response; 83 | 84 | use crate::server::get_app; 85 | 86 | mock! { 87 | pub Database { 88 | fn get_pet(&self, id: i32) -> Result> {} 89 | fn create_pet(&self, pet: &Pet) -> Result<(), Box> {} 90 | fn find_all(&self) -> Result, Box> {} 91 | } 92 | } 93 | 94 | #[async_trait] 95 | impl Repository for MockDatabase { 96 | async fn get_pet(&self, id: i32) -> Result> { 97 | self.get_pet(id) 98 | } 99 | async fn create_pet(&self, pet: &Pet) -> Result<(), Box> { 100 | self.create_pet(pet) 101 | } 102 | async fn find_all(&self) -> Result, Box> { 103 | self.find_all() 104 | } 105 | } 106 | 107 | #[async_std::test] 108 | async fn test_get_pet() { 109 | let id: i32 = 1; 110 | let name = "Tom"; 111 | let mut mock_db = MockDatabase::default(); 112 | mock_db 113 | .expect_get_pet() 114 | .with(predicate::eq(id)) 115 | .times(1) 116 | .returning(move |_| { 117 | Ok(Pet { 118 | id, 119 | name: String::from(name), 120 | tag: None, 121 | }) 122 | }); 123 | let app = get_app(Box::new(mock_db)) 124 | .await 125 | .expect("could not create app"); 126 | let mut req = http_types::Request::new( 127 | http_types::Method::Get, 128 | Url::parse("http://localhost:8181/pet/1").unwrap(), 129 | ); 130 | req.set_body( 131 | json!({ 132 | "id": id, 133 | "name": name 134 | }) 135 | .to_string(), 136 | ); 137 | let mut res: Response = app.respond(req).await.unwrap(); 138 | 139 | assert_eq!(200, res.status()); 140 | let body = res.take_body().into_string().await.unwrap(); 141 | 142 | if let Ok(pet) = serde_json::from_str::(&body) { 143 | assert_eq!(id, pet.id); 144 | assert_eq!(name, pet.name); 145 | assert_eq!(Option::None, pet.tag); 146 | }; 147 | } 148 | 149 | #[async_std::test] 150 | async fn test_get_pets() { 151 | let id: i32 = 1; 152 | let name = "Tom"; 153 | let mut mock_db = MockDatabase::default(); 154 | mock_db.expect_find_all().times(1).returning(move || { 155 | Ok(vec![Pet { 156 | id, 157 | name: String::from(name), 158 | tag: Option::None, 159 | }]) 160 | }); 161 | let app = get_app(Box::new(mock_db)) 162 | .await 163 | .expect("could not create app"); 164 | let req = http_types::Request::new( 165 | http_types::Method::Get, 166 | Url::parse("http://localhost:8181/pets").unwrap(), 167 | ); 168 | 169 | let mut res: Response = app.respond(req).await.unwrap(); 170 | 171 | assert_eq!(200, res.status()); 172 | 173 | let body = res.take_body().into_string().await.unwrap(); 174 | if let Ok(pets) = serde_json::from_str::>(&body) { 175 | assert_eq!(1, pets.len()); 176 | assert_eq!(id, pets[0].id); 177 | assert_eq!(name, pets[0].name); 178 | assert_eq!(Option::None, pets[0].tag); 179 | }; 180 | } 181 | 182 | #[async_std::test] 183 | async fn test_create_pet() { 184 | let id: i32 = 1; 185 | let name = "Tom"; 186 | let mut mock_db = MockDatabase::default(); 187 | mock_db 188 | .expect_create_pet() 189 | .with(predicate::eq(Pet { 190 | id, 191 | name: String::from(name), 192 | tag: Option::None, 193 | })) 194 | .times(1) 195 | .returning(move |_| Ok(())); 196 | let app = get_app(Box::new(mock_db)) 197 | .await 198 | .expect("could not create app"); 199 | let mut req = http_types::Request::new( 200 | http_types::Method::Post, 201 | Url::parse("http://localhost:8181/pet").unwrap(), 202 | ); 203 | req.set_body( 204 | json!({ 205 | "id": id, 206 | "name": name 207 | }) 208 | .to_string(), 209 | ); 210 | 211 | let mut res: Response = app.respond(req).await.unwrap(); 212 | 213 | assert_eq!(201, res.status()); 214 | let body = res.take_body().into_string().await.unwrap(); 215 | assert_eq!("", body); 216 | } 217 | } 218 | -------------------------------------------------------------------------------- /api/src/main.rs: -------------------------------------------------------------------------------- 1 | use async_std::prelude::*; 2 | use async_std::task; 3 | use database::postgres::Postgres; 4 | use dotenv::dotenv; 5 | use tide::log; 6 | 7 | mod error_response; 8 | mod handlers; 9 | mod server; 10 | mod state; 11 | 12 | use server::get_app; 13 | use state::State; 14 | 15 | fn main() -> tide::Result<()> { 16 | task::block_on(async { 17 | femme::ndjson::Logger::new() 18 | .start(log::Level::Info.to_level_filter()) 19 | .unwrap(); 20 | dotenv().ok(); 21 | 22 | let (db, ()) = Postgres::new().join(database::migration::run()).await; 23 | 24 | let app = get_app(Box::new(db)).await?; 25 | 26 | app.listen("127.0.0.1:8181").await?; 27 | Ok(()) 28 | }) 29 | } 30 | -------------------------------------------------------------------------------- /api/src/server.rs: -------------------------------------------------------------------------------- 1 | use models::repository::Repository; 2 | use std::fs; 3 | use tide::{Response, Server, StatusCode}; 4 | 5 | use crate::handlers; 6 | use crate::State; 7 | 8 | pub(crate) async fn get_app( 9 | repository: Box, 10 | ) -> tide::Result> { 11 | let state = State::new(repository).await?; 12 | let mut app = tide::with_state(state); 13 | 14 | app.at("/pets").get(handlers::get_pets); 15 | app.at("/pet").post(handlers::create_pet); 16 | app.at("/pet/:id").get(handlers::get_pet); 17 | 18 | app.at("/healthz") 19 | .get(|_| async { Ok(Response::new(StatusCode::Ok)) }); 20 | app.at("/oas") 21 | .get(|_| async { Ok(fs::read_to_string("oas/v1.yaml")?) }); 22 | 23 | Ok(app) 24 | } 25 | -------------------------------------------------------------------------------- /api/src/state.rs: -------------------------------------------------------------------------------- 1 | use models::repository::Repository; 2 | 3 | pub(crate) struct State { 4 | db: Box, 5 | } 6 | 7 | impl State { 8 | pub(crate) async fn new( 9 | repository: Box, 10 | ) -> tide::Result { 11 | Ok(Self { db: repository }) 12 | } 13 | 14 | pub fn db(&self) -> &Box { 15 | &self.db 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /database/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "database" 3 | version = "0.1.0" 4 | authors = ["matthewcobbing "] 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 | models = { path = "../models" } 11 | refinery = { version = "0.3.0", features = ["postgres"]} 12 | postgres = "0.17.3" 13 | sqlx = { version = "0.3.5", features = [ "postgres" ] } 14 | sql-builder = "0.12.0" 15 | async-trait = "0.1.36" -------------------------------------------------------------------------------- /database/migrations/V1__initial.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS pets ( 2 | id INTEGER UNIQUE PRIMARY KEY, 3 | name VARCHAR NOT NULL, 4 | tag VARCHAR NULL 5 | ); -------------------------------------------------------------------------------- /database/src/db_error.rs: -------------------------------------------------------------------------------- 1 | use postgres::Error as PostgresError; 2 | use refinery::Error as RefineryError; 3 | use sqlx::Error as SQLXError; 4 | use std::error::Error; 5 | use std::fmt; 6 | 7 | #[derive(Debug)] 8 | pub struct DatabaseError { 9 | details: String, 10 | } 11 | 12 | impl DatabaseError { 13 | fn new(msg: &str) -> DatabaseError { 14 | DatabaseError { 15 | details: msg.to_string(), 16 | } 17 | } 18 | 19 | pub fn detail(&self) -> String { 20 | self.details.clone() 21 | } 22 | } 23 | 24 | impl fmt::Display for DatabaseError { 25 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 26 | write!(f, "{}", self.details) 27 | } 28 | } 29 | 30 | impl Error for DatabaseError { 31 | fn description(&self) -> &str { 32 | &self.details 33 | } 34 | } 35 | 36 | impl From for DatabaseError { 37 | fn from(err: PostgresError) -> Self { 38 | DatabaseError::new(&err.to_string()) 39 | } 40 | } 41 | 42 | impl From for DatabaseError { 43 | fn from(err: RefineryError) -> Self { 44 | DatabaseError::new(&err.to_string()) 45 | } 46 | } 47 | 48 | impl From for DatabaseError { 49 | fn from(err: SQLXError) -> Self { 50 | DatabaseError::new(&err.to_string()) 51 | } 52 | } 53 | 54 | impl From> 55 | for DatabaseError 56 | { 57 | fn from( 58 | err: std::boxed::Box, 59 | ) -> Self { 60 | DatabaseError::new(&err.to_string()) 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /database/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod db_error; 2 | pub mod migration; 3 | pub mod postgres; 4 | -------------------------------------------------------------------------------- /database/src/migration.rs: -------------------------------------------------------------------------------- 1 | use postgres::{Client, NoTls}; 2 | use refinery::embed_migrations; 3 | use std::env; 4 | 5 | embed_migrations!("./migrations"); 6 | 7 | pub async fn run() -> () { 8 | let database_url = env::var("DATABASE_URL").expect("DATABASE_URL is not set in .env file"); 9 | let mut client = Client::connect(&database_url, NoTls).expect("could not connect to database"); 10 | 11 | migrations::runner() 12 | .run(&mut client) 13 | .expect("could not run migrations"); 14 | () 15 | } 16 | -------------------------------------------------------------------------------- /database/src/postgres.rs: -------------------------------------------------------------------------------- 1 | use async_trait::async_trait; 2 | use models::pet::Pet; 3 | use models::repository::Repository; 4 | use sql_builder::prelude::*; 5 | use sqlx::postgres::PgQueryAs; 6 | use sqlx::PgPool; 7 | use std::env; 8 | use std::error::Error; 9 | use std::result::Result; 10 | 11 | use crate::db_error::DatabaseError; 12 | 13 | #[derive(Debug)] 14 | pub struct Postgres { 15 | pool: sqlx::PgPool, 16 | } 17 | 18 | impl Postgres { 19 | pub async fn new() -> Self { 20 | let database_url = env::var("DATABASE_URL").expect("DATABASE_URL is not set in .env file"); 21 | let pool = PgPool::new(&database_url) 22 | .await 23 | .expect("could not create postgres connnection pool"); 24 | 25 | Postgres { pool } 26 | } 27 | } 28 | 29 | #[async_trait] 30 | impl Repository for Postgres { 31 | async fn get_pet(&self, id: i32) -> Result> { 32 | let sql = SqlBuilder::select_from("pets") 33 | .fields(&["id", "name", "tag"]) 34 | .and_where("id = ?".bind(&id)) 35 | .sql() 36 | .map_err(DatabaseError::from)?; 37 | 38 | let pet = sqlx::query_as::<_, Pet>(&sql).fetch_one(&self.pool).await?; 39 | 40 | Ok(pet) 41 | } 42 | 43 | async fn create_pet(&self, pet: &Pet) -> Result<(), Box> { 44 | let sql = SqlBuilder::insert_into("pets") 45 | .field("id") 46 | .field("name") 47 | .field("tag") 48 | .values(&["$1, $2, $3"]) 49 | .sql() 50 | .map_err(DatabaseError::from)?; 51 | 52 | let mut tx = self.pool.begin().await?; 53 | 54 | sqlx::query(&sql) 55 | .bind(&pet.id) 56 | .bind(&pet.name) 57 | .bind(&pet.tag) 58 | .execute(&mut tx) 59 | .await?; 60 | 61 | tx.commit().await?; 62 | Ok(()) 63 | } 64 | 65 | async fn find_all(&self) -> Result, Box> { 66 | let sql = SqlBuilder::select_from("pets") 67 | .fields(&["id", "name", "tag"]) 68 | .order_by("id", false) 69 | .sql() 70 | .map_err(DatabaseError::from)?; 71 | 72 | let pets = sqlx::query_as::<_, Pet>(&sql).fetch_all(&self.pool).await?; 73 | 74 | Ok(pets) 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | example-db: 4 | image: "postgres" 5 | container_name: "example-rust_db" 6 | environment: 7 | - POSTGRES_PASSWORD=example 8 | - POSTGRES_DB=example 9 | - POSTGRES_USER=example 10 | ports: 11 | - "5432:5432" 12 | volumes: 13 | - example-rust_data:/var/lib/postgresql/data 14 | volumes: 15 | example-rust_data: -------------------------------------------------------------------------------- /models/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "models" 3 | version = "0.1.0" 4 | authors = ["matthewcobbing "] 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 = "1.0.110" 11 | serde_derive = "1.0.110" 12 | async-trait = "0.1.36" 13 | sqlx = { version = "0.3.5", features = [ "postgres" ] } 14 | -------------------------------------------------------------------------------- /models/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod pet; 2 | pub mod repository; 3 | -------------------------------------------------------------------------------- /models/src/pet.rs: -------------------------------------------------------------------------------- 1 | #[derive( 2 | Default, 3 | Debug, 4 | Clone, 5 | PartialEq, 6 | serde_derive::Serialize, 7 | serde_derive::Deserialize, 8 | sqlx::FromRow, 9 | )] 10 | #[serde(rename_all = "camelCase")] 11 | pub struct Pet { 12 | pub id: i32, 13 | pub name: String, 14 | pub tag: Option, 15 | } 16 | -------------------------------------------------------------------------------- /models/src/repository.rs: -------------------------------------------------------------------------------- 1 | use async_trait::async_trait; 2 | use std::error::Error; 3 | 4 | use crate::pet::Pet; 5 | 6 | #[async_trait] 7 | pub trait Repository { 8 | async fn get_pet(&self, id: i32) -> Result>; 9 | async fn create_pet(&self, pet: &Pet) -> Result<(), Box>; 10 | async fn find_all(&self) -> Result, Box>; 11 | } 12 | -------------------------------------------------------------------------------- /oas/v1.yaml: -------------------------------------------------------------------------------- 1 | openapi: "3.0.0" 2 | info: 3 | version: 1.0.0 4 | title: Swagger Petstore 5 | license: 6 | name: MIT 7 | servers: 8 | - url: http://petstore.swagger.io/v1 9 | paths: 10 | /pets: 11 | get: 12 | summary: List all pets 13 | operationId: listPets 14 | tags: 15 | - pets 16 | parameters: 17 | - name: limit 18 | in: query 19 | description: How many items to return at one time (max 100) 20 | required: false 21 | schema: 22 | type: integer 23 | format: int32 24 | responses: 25 | '200': 26 | description: A paged array of pets 27 | headers: 28 | x-next: 29 | description: A link to the next page of responses 30 | schema: 31 | type: string 32 | content: 33 | application/json: 34 | schema: 35 | $ref: "#/components/schemas/Pets" 36 | default: 37 | description: unexpected error 38 | content: 39 | application/json: 40 | schema: 41 | $ref: "#/components/schemas/Error" 42 | post: 43 | summary: Create a pet 44 | operationId: createPets 45 | tags: 46 | - pets 47 | responses: 48 | '201': 49 | description: Null response 50 | default: 51 | description: unexpected error 52 | content: 53 | application/json: 54 | schema: 55 | $ref: "#/components/schemas/Error" 56 | /pets/{petId}: 57 | get: 58 | summary: Info for a specific pet 59 | operationId: showPetById 60 | tags: 61 | - pets 62 | parameters: 63 | - name: petId 64 | in: path 65 | required: true 66 | description: The id of the pet to retrieve 67 | schema: 68 | type: string 69 | responses: 70 | '200': 71 | description: Expected response to a valid request 72 | content: 73 | application/json: 74 | schema: 75 | $ref: "#/components/schemas/Pet" 76 | default: 77 | description: unexpected error 78 | content: 79 | application/json: 80 | schema: 81 | $ref: "#/components/schemas/Error" 82 | components: 83 | schemas: 84 | Pet: 85 | type: object 86 | required: 87 | - id 88 | - name 89 | properties: 90 | id: 91 | type: integer 92 | format: int64 93 | name: 94 | type: string 95 | tag: 96 | type: string 97 | Pets: 98 | type: array 99 | items: 100 | $ref: "#/components/schemas/Pet" 101 | Error: 102 | type: object 103 | required: 104 | - code 105 | - message 106 | properties: 107 | code: 108 | type: integer 109 | format: int32 110 | message: 111 | type: string --------------------------------------------------------------------------------