diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..3c6253d --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,9 @@ +FROM ubuntu:18.04 + +WORKDIR /home/ + +COPY . . + +RUN bash ./setup.sh + +ENV PATH="/root/.cargo/bin:$PATH" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..6e9695e --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,20 @@ +{ + "name": "Codespaces Rust Starter", + "extensions": [ + "cschleiden.vscode-github-actions", + "ms-vsliveshare.vsliveshare", + "matklad.rust-analyzer", + "serayuzgur.crates", + "vadimcn.vscode-lldb", + "GitHub.copilot" + ], + "dockerFile": "Dockerfile", + "settings": { + "editor.formatOnSave": true, + "terminal.integrated.shell.linux": "/usr/bin/zsh", + "files.exclude": { + "**/CODE_OF_CONDUCT.md": true, + "**/LICENSE": true + } + } +} \ No newline at end of file diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh new file mode 100644 index 0000000..b139217 --- /dev/null +++ b/.devcontainer/setup.sh @@ -0,0 +1,32 @@ +## update and install some things we should probably have +apt-get update +apt-get install -y \ + curl \ + git \ + gnupg2 \ + jq \ + sudo \ + zsh \ + vim \ + build-essential \ + openssl \ + pkg-config \ + libssl-dev + +## Install rustup and common components +curl https://sh.rustup.rs -sSf | sh -s -- -y +rustup install nightly +rustup component add rustfmt +rustup component add rustfmt --toolchain nightly +rustup component add clippy +rustup component add clippy --toolchain nightly + +cargo install cargo-expand +cargo install cargo-edit + +## setup and install oh-my-zsh +sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" +cp -R /root/.oh-my-zsh /home/$USERNAME +cp /root/.zshrc /home/$USERNAME +sed -i -e "s/\/root\/.oh-my-zsh/\/home\/$USERNAME\/.oh-my-zsh/g" /home/$USERNAME/.zshrc +chown -R $USER_UID:$USER_GID /home/$USERNAME/.oh-my-zsh /home/$USERNAME/.zshrc \ No newline at end of file diff --git a/.gitignore b/.gitignore index 0669918..6bd79e5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ /target/ **/*.rs.bk -Cargo.lock .idea/ \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..d87326f --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1548 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +dependencies = [ + "memchr", +] + +[[package]] +name = "assert-json-diff" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f1c3703dd33532d7f0ca049168930e9099ecac238e23cf932f3a69c42f06da" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" +dependencies = [ + "byteorder", + "iovec", +] + +[[package]] +name = "bytes" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" + +[[package]] +name = "cc" +version = "1.0.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +dependencies = [ + "libc", + "num-integer", + "num-traits", + "serde", + "time", + "winapi 0.3.9", +] + +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +dependencies = [ + "bitflags", +] + +[[package]] +name = "colored" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" +dependencies = [ + "atty", + "lazy_static", + "winapi 0.3.9", +] + +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + +[[package]] +name = "crossbeam-deque" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20ff29ded3204c5106278a81a38f4b482636ed4fa1e6cfbeef193291beb29ed" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", + "maybe-uninit", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" +dependencies = [ + "autocfg", + "cfg-if 0.1.10", + "crossbeam-utils", + "lazy_static", + "maybe-uninit", + "memoffset", + "scopeguard", +] + +[[package]] +name = "crossbeam-queue" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" +dependencies = [ + "cfg-if 0.1.10", + "crossbeam-utils", + "maybe-uninit", +] + +[[package]] +name = "crossbeam-utils" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" +dependencies = [ + "autocfg", + "cfg-if 0.1.10", + "lazy_static", +] + +[[package]] +name = "either" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + +[[package]] +name = "fastrand" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" +dependencies = [ + "instant", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +dependencies = [ + "matches", + "percent-encoding", +] + +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +dependencies = [ + "bitflags", + "fuchsia-zircon-sys", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" + +[[package]] +name = "futures" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" + +[[package]] +name = "futures" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" + +[[package]] +name = "futures-executor" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" + +[[package]] +name = "futures-macro" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" + +[[package]] +name = "futures-task" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" + +[[package]] +name = "futures-util" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "gdax_rs" +version = "0.1.0" +dependencies = [ + "chrono", + "futures 0.3.21", + "hyper", + "hyper-tls", + "itertools", + "mockito", + "percent-encoding", + "serde", + "serde_derive", + "serde_json", + "tokio 1.19.2", + "tokio-core", +] + +[[package]] +name = "getrandom" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.10.2+wasi-snapshot-preview1", +] + +[[package]] +name = "h2" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57" +dependencies = [ + "bytes 1.1.0", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio 1.19.2", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "http" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +dependencies = [ + "bytes 1.1.0", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes 1.1.0", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c" + +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "hyper" +version = "0.14.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42dc3c131584288d375f2d07f822b0cb012d8c6fb899a5b9fdb3cb7eb9b6004f" +dependencies = [ + "bytes 1.1.0", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio 1.19.2", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes 1.1.0", + "hyper", + "native-tls", + "tokio 1.19.2", + "tokio-native-tls", +] + +[[package]] +name = "indexmap" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "iovec" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +dependencies = [ + "libc", +] + +[[package]] +name = "itertools" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" + +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" + +[[package]] +name = "lock_api" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "lock_api" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "matches" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" + +[[package]] +name = "maybe-uninit" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "memoffset" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" +dependencies = [ + "autocfg", +] + +[[package]] +name = "mio" +version = "0.6.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +dependencies = [ + "cfg-if 0.1.10", + "fuchsia-zircon", + "fuchsia-zircon-sys", + "iovec", + "kernel32-sys", + "libc", + "log", + "miow", + "net2", + "slab", + "winapi 0.2.8", +] + +[[package]] +name = "mio" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713d550d9b44d89174e066b7a6217ae06234c10cb47819a88290d2b353c31799" +dependencies = [ + "libc", + "log", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys", +] + +[[package]] +name = "mio-uds" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" +dependencies = [ + "iovec", + "libc", + "mio 0.6.23", +] + +[[package]] +name = "miow" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" +dependencies = [ + "kernel32-sys", + "net2", + "winapi 0.2.8", + "ws2_32-sys", +] + +[[package]] +name = "mockito" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "401edc088069634afaa5f4a29617b36dba683c0c16fe4435a86debad23fa2f1a" +dependencies = [ + "assert-json-diff", + "colored", + "httparse", + "lazy_static", + "log", + "rand", + "regex", + "serde_json", + "serde_urlencoded", + "similar", +] + +[[package]] +name = "native-tls" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd7e2f3618557f980e0b17e8856252eee3c97fa12c54dff0ca290fb6266ca4a9" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "net2" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "once_cell" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225" + +[[package]] +name = "openssl" +version = "0.10.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb81a6430ac911acb25fe5ac8f1d2af1b4ea8a4fdfda0f1ee4292af2e2d8eb0e" +dependencies = [ + "bitflags", + "cfg-if 1.0.0", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835363342df5fba8354c5b453325b110ffd54044e588c539cf2f20a8014e4cb1" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "parking_lot" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" +dependencies = [ + "lock_api 0.3.4", + "parking_lot_core 0.6.2", + "rustc_version", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api 0.4.7", + "parking_lot_core 0.9.3", +] + +[[package]] +name = "parking_lot_core" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" +dependencies = [ + "cfg-if 0.1.10", + "cloudabi", + "libc", + "redox_syscall 0.1.57", + "rustc_version", + "smallvec 0.6.14", + "winapi 0.3.9", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "redox_syscall 0.2.13", + "smallvec 1.8.0", + "windows-sys", +] + +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" + +[[package]] +name = "pin-project-lite" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" + +[[package]] +name = "ppv-lite86" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" + +[[package]] +name = "proc-macro2" +version = "1.0.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +dependencies = [ + "getrandom", +] + +[[package]] +name = "redox_syscall" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" + +[[package]] +name = "redox_syscall" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64" + +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver", +] + +[[package]] +name = "ryu" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" + +[[package]] +name = "schannel" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" +dependencies = [ + "lazy_static", + "windows-sys", +] + +[[package]] +name = "scoped-tls" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "security-framework" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "serde" +version = "1.0.137" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" + +[[package]] +name = "serde_derive" +version = "1.0.137" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +dependencies = [ + "libc", +] + +[[package]] +name = "similar" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e24979f63a11545f5f2c60141afe249d4f19f84581ea2138065e400941d83d3" + +[[package]] +name = "slab" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" + +[[package]] +name = "smallvec" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" +dependencies = [ + "maybe-uninit", +] + +[[package]] +name = "smallvec" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" + +[[package]] +name = "socket2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" +dependencies = [ + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "syn" +version = "1.0.96" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tempfile" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +dependencies = [ + "cfg-if 1.0.0", + "fastrand", + "libc", + "redox_syscall 0.2.13", + "remove_dir_all", + "winapi 0.3.9", +] + +[[package]] +name = "time" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +dependencies = [ + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "tokio" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.31", + "mio 0.6.23", + "num_cpus", + "tokio-codec", + "tokio-current-thread", + "tokio-executor", + "tokio-fs", + "tokio-io", + "tokio-reactor", + "tokio-sync", + "tokio-tcp", + "tokio-threadpool", + "tokio-timer", + "tokio-udp", + "tokio-uds", +] + +[[package]] +name = "tokio" +version = "1.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c51a52ed6686dd62c320f9b89299e9dfb46f730c7a48e635c19f21d116cb1439" +dependencies = [ + "bytes 1.1.0", + "libc", + "memchr", + "mio 0.8.3", + "num_cpus", + "once_cell", + "parking_lot 0.12.1", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "winapi 0.3.9", +] + +[[package]] +name = "tokio-codec" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25b2998660ba0e70d18684de5d06b70b70a3a747469af9dea7618cc59e75976b" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.31", + "tokio-io", +] + +[[package]] +name = "tokio-core" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87b1395334443abca552f63d4f61d0486f12377c2ba8b368e523f89e828cffd4" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.31", + "iovec", + "log", + "mio 0.6.23", + "scoped-tls", + "tokio 0.1.22", + "tokio-executor", + "tokio-io", + "tokio-reactor", + "tokio-timer", +] + +[[package]] +name = "tokio-current-thread" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1de0e32a83f131e002238d7ccde18211c0a5397f60cbfffcb112868c2e0e20e" +dependencies = [ + "futures 0.1.31", + "tokio-executor", +] + +[[package]] +name = "tokio-executor" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671" +dependencies = [ + "crossbeam-utils", + "futures 0.1.31", +] + +[[package]] +name = "tokio-fs" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "297a1206e0ca6302a0eed35b700d292b275256f596e2f3fea7729d5e629b6ff4" +dependencies = [ + "futures 0.1.31", + "tokio-io", + "tokio-threadpool", +] + +[[package]] +name = "tokio-io" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.31", + "log", +] + +[[package]] +name = "tokio-macros" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +dependencies = [ + "native-tls", + "tokio 1.19.2", +] + +[[package]] +name = "tokio-reactor" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351" +dependencies = [ + "crossbeam-utils", + "futures 0.1.31", + "lazy_static", + "log", + "mio 0.6.23", + "num_cpus", + "parking_lot 0.9.0", + "slab", + "tokio-executor", + "tokio-io", + "tokio-sync", +] + +[[package]] +name = "tokio-sync" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee" +dependencies = [ + "fnv", + "futures 0.1.31", +] + +[[package]] +name = "tokio-tcp" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98df18ed66e3b72e742f185882a9e201892407957e45fbff8da17ae7a7c51f72" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.31", + "iovec", + "mio 0.6.23", + "tokio-io", + "tokio-reactor", +] + +[[package]] +name = "tokio-threadpool" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df720b6581784c118f0eb4310796b12b1d242a7eb95f716a8367855325c25f89" +dependencies = [ + "crossbeam-deque", + "crossbeam-queue", + "crossbeam-utils", + "futures 0.1.31", + "lazy_static", + "log", + "num_cpus", + "slab", + "tokio-executor", +] + +[[package]] +name = "tokio-timer" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296" +dependencies = [ + "crossbeam-utils", + "futures 0.1.31", + "slab", + "tokio-executor", +] + +[[package]] +name = "tokio-udp" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2a0b10e610b39c38b031a2fcab08e4b82f16ece36504988dcbd81dbba650d82" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.31", + "log", + "mio 0.6.23", + "tokio-codec", + "tokio-io", + "tokio-reactor", +] + +[[package]] +name = "tokio-uds" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab57a4ac4111c8c9dbcf70779f6fc8bc35ae4b2454809febac840ad19bd7e4e0" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.31", + "iovec", + "libc", + "log", + "mio 0.6.23", + "mio-uds", + "tokio-codec", + "tokio-io", + "tokio-reactor", +] + +[[package]] +name = "tokio-util" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45" +dependencies = [ + "bytes 1.1.0", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio 1.19.2", + "tracing", +] + +[[package]] +name = "tower-service" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" + +[[package]] +name = "tracing" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09" +dependencies = [ + "cfg-if 1.0.0", + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + +[[package]] +name = "unicode-ident" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.10.2+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_i686_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" + +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] diff --git a/Cargo.toml b/Cargo.toml index a287a89..303c31e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,16 +2,18 @@ name = "gdax_rs" version = "0.1.0" authors = ["Tristan Marechaux "] +edition = "2021" [dependencies] -mockito = "0.9.0" -hyper = "0.11" +mockito = "0.31" +hyper = { version = "0.14", features = ["full"] } +tokio = { version = "1", features = ["full"] } tokio-core = "0.1" -hyper-tls = "0.1.2" -futures = "0.1" +hyper-tls = "0.5" +futures = "0.3" serde = "1.0" serde_derive = "1.0" serde_json = "1.0" -itertools = "0.7.4" +itertools = "0.10" chrono = { version = "0.4", features = ["serde"] } -percent-encoding = "1.0.0" \ No newline at end of file +percent-encoding = "2.1" \ No newline at end of file diff --git a/examples/get_24hr_stats.rs b/examples/get_24hr_stats.rs index c5c9ad7..c6a7ca8 100644 --- a/examples/get_24hr_stats.rs +++ b/examples/get_24hr_stats.rs @@ -6,14 +6,13 @@ use tokio_core::reactor::Core; use gdax_rs::RESTClient; use gdax_rs::products::Get24hrStats; -fn main() { +#[tokio::main] +async fn main() { let mut core = Core::new().unwrap(); let handle = core.handle(); - let mut test_client = RESTClient::default(&handle); - let product_ticker = core.run( - test_client.send_request(&Get24hrStats::new(String::from("BTC-USD"))), - ).unwrap(); + let mut test_client = RESTClient::default(); + let product_ticker = test_client.send_request(&Get24hrStats::new(String::from("BTC-USD"))).await.unwrap(); println!("{:?}", product_ticker); } diff --git a/examples/get_currencies.rs b/examples/get_currencies.rs index 76d3d94..32457da 100644 --- a/examples/get_currencies.rs +++ b/examples/get_currencies.rs @@ -6,13 +6,13 @@ use tokio_core::reactor::Core; use gdax_rs::RESTClient; use gdax_rs::currencies::GetCurrencies; -fn main() { +#[tokio::main] +async fn main() { let mut core = Core::new().unwrap(); let handle = core.handle(); - let mut test_client = RESTClient::default(&handle); - let products = core.run(test_client.send_request(&GetCurrencies::new())) - .unwrap(); + let mut test_client = RESTClient::default(); + let products = test_client.send_request(&GetCurrencies::new()).await.unwrap(); println!("{:?}", products); } diff --git a/examples/get_historic_rates.rs b/examples/get_historic_rates.rs index b766c3c..b997513 100644 --- a/examples/get_historic_rates.rs +++ b/examples/get_historic_rates.rs @@ -8,17 +8,18 @@ use chrono::{TimeZone, Utc}; use gdax_rs::RESTClient; use gdax_rs::products::GetHistoricRates; -fn main() { +#[tokio::main] +async fn main() { let mut core = Core::new().unwrap(); let handle = core.handle(); - let mut test_client = RESTClient::default(&handle); - let candles = core.run(test_client.send_request(&GetHistoricRates::new( + let mut test_client = RESTClient::default(); + let candles = test_client.send_request(&GetHistoricRates::new( String::from("BTC-USD"), Utc.ymd(2017, 12, 21).and_hms_micro(10, 10, 10, 10), Utc.ymd(2017, 12, 21).and_hms_micro(10, 15, 15, 10), 60, - ))).unwrap(); + )).await.unwrap(); println!("{:?}", candles); } diff --git a/examples/get_product.rs b/examples/get_product.rs index 4094dc2..a007a51 100644 --- a/examples/get_product.rs +++ b/examples/get_product.rs @@ -6,13 +6,13 @@ use tokio_core::reactor::Core; use gdax_rs::RESTClient; use gdax_rs::products::GetProducts; -fn main() { +#[tokio::main] +async fn main() { let mut core = Core::new().unwrap(); let handle = core.handle(); - let mut test_client = RESTClient::default(&handle); - let products = core.run(test_client.send_request(&GetProducts::new())) - .unwrap(); + let mut test_client = RESTClient::default(); + let products = test_client.send_request(&GetProducts::new()).await.unwrap(); println!("{:?}", products); } diff --git a/examples/get_product_order_book.rs b/examples/get_product_order_book.rs index 979ad66..be81f6f 100644 --- a/examples/get_product_order_book.rs +++ b/examples/get_product_order_book.rs @@ -1,20 +1,21 @@ extern crate gdax_rs; extern crate tokio_core; -use tokio_core::reactor::Core; +// use tokio_core::reactor::Core; use gdax_rs::RESTClient; use gdax_rs::products::{GetProductOrderBook, Level}; -fn main() { - let mut core = Core::new().unwrap(); - let handle = core.handle(); +#[tokio::main] +async fn main() { + // let mut core = Core::new().unwrap(); + // let handle = core.handle(); - let mut test_client = RESTClient::default(&handle); - let order_book = core.run(test_client.send_request(&GetProductOrderBook::new( + let mut test_client = RESTClient::default(); + let order_book = test_client.send_request(&GetProductOrderBook::new( String::from("BTC-USD"), Level::Level2, - ))).unwrap(); + )).await.unwrap(); println!("{:?}", order_book); } diff --git a/examples/get_product_ticker.rs b/examples/get_product_ticker.rs index 79dc8f6..5027086 100644 --- a/examples/get_product_ticker.rs +++ b/examples/get_product_ticker.rs @@ -6,14 +6,15 @@ use tokio_core::reactor::Core; use gdax_rs::RESTClient; use gdax_rs::products::GetProductTicker; -fn main() { +#[tokio::main] +async fn main() { let mut core = Core::new().unwrap(); let handle = core.handle(); - let mut test_client = RESTClient::default(&handle); - let product_ticker = core.run( - test_client.send_request(&GetProductTicker::new(String::from("BTC-USD"))), - ).unwrap(); + let mut test_client = RESTClient::default(); + let product_ticker = + test_client.send_request(&GetProductTicker::new(String::from("BTC-USD"))) + .await.unwrap(); println!("{:?}", product_ticker); } diff --git a/examples/get_time.rs b/examples/get_time.rs index 3718da5..0ddce12 100644 --- a/examples/get_time.rs +++ b/examples/get_time.rs @@ -1,17 +1,19 @@ extern crate gdax_rs; extern crate tokio_core; -use tokio_core::reactor::Core; +// use tokio_core::reactor::Core; use gdax_rs::RESTClient; use gdax_rs::time::GetTime; -fn main() { - let mut core = Core::new().unwrap(); - let handle = core.handle(); - let mut test_client = RESTClient::default(&handle); - let products = core.run(test_client.send_request(&GetTime::new())).unwrap(); +#[tokio::main] +async fn main() { + // let mut core = Core::new().unwrap(); + // let handle = core.handle(); + + let mut test_client = RESTClient::default(); + let products = test_client.send_request(&GetTime::new()).await.unwrap(); println!("{:?}", products); } diff --git a/examples/get_trades.rs b/examples/get_trades.rs index 81e1ba0..909915c 100644 --- a/examples/get_trades.rs +++ b/examples/get_trades.rs @@ -2,18 +2,18 @@ extern crate gdax_rs; extern crate tokio_core; use tokio_core::reactor::Core; +use tokio; use gdax_rs::RESTClient; use gdax_rs::products::GetTrades; -fn main() { +#[tokio::main] +async fn main() { let mut core = Core::new().unwrap(); let handle = core.handle(); - let mut test_client = RESTClient::default(&handle); - let product_ticker = core.run( - test_client.send_request(&GetTrades::new(String::from("BTC-USD"))), - ).unwrap(); + let mut test_client = RESTClient::default(); + let product_ticker = test_client.send_request(&GetTrades::new(String::from("BTC-USD"))).await.unwrap(); println!("{:?}", product_ticker); } diff --git a/src/currencies.rs b/src/currencies.rs index 444dc90..bc6ff6e 100644 --- a/src/currencies.rs +++ b/src/currencies.rs @@ -2,10 +2,11 @@ //! "Market Data/Currencies" section () use hyper::Method; +use serde_derive::{Serialize, Deserialize}; -use serde_util::deserialize_from_str; -use rest_client::{EndPointRequest, RestRequest}; -use url::Route; +use crate::rest_client::{EndPointRequest, RestRequest}; +use crate::url::Route; +use crate::serde_util::deserialize_from_str; #[derive(Default)] pub struct GetCurrencies; @@ -27,7 +28,7 @@ pub struct Currency { impl EndPointRequest> for GetCurrencies { fn create_request(&self) -> RestRequest { RestRequest { - http_method: Method::Get, + http_method: Method::GET, route: Route::new().add_segment(&"currencies"), body: String::new(), } @@ -46,7 +47,7 @@ mod tests { let result = GetCurrencies::new().create_request(); let expected = RestRequest { - http_method: Method::Get, + http_method: Method::GET, route: Route::new().add_segment(&"currencies"), body: String::new(), }; diff --git a/src/error.rs b/src/error.rs index d775d22..b5d18c7 100644 --- a/src/error.rs +++ b/src/error.rs @@ -52,7 +52,7 @@ impl Error for RestError { } } - fn cause(&self) -> Option<&Error> { + fn cause(&self) -> Option<&dyn Error> { None } } @@ -82,18 +82,12 @@ impl fmt::Display for RestError { } } -impl From for RestError { - fn from(uri_error: hyper::error::UriError) -> RestError { +impl From for RestError { + fn from(uri_error: hyper::Error) -> RestError { RestError::UriError(uri_error.to_string()) } } -impl From for RestError { - fn from(error: hyper::error::Error) -> RestError { - RestError::RequestError(error.to_string()) - } -} - impl From for RestError { fn from(utf8_error: FromUtf8Error) -> RestError { RestError::FromUtf8Error(utf8_error) @@ -105,3 +99,4 @@ impl From for RestError { RestError::CoreError(io_error) } } + diff --git a/src/lib.rs b/src/lib.rs index 65ed1a6..3ba0db0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,20 +13,6 @@ //! The public modules are organised following the same tree as the [GDAX documentation](https://docs.gdax.com/). //! //! # Examples - -extern crate chrono; -extern crate futures; -extern crate hyper; -extern crate hyper_tls; -extern crate itertools; -extern crate mockito; -extern crate percent_encoding; -extern crate serde; -#[macro_use] -extern crate serde_derive; -extern crate serde_json; -extern crate tokio_core; - pub mod products; pub mod currencies; pub mod time; diff --git a/src/products/get_24hr_stats.rs b/src/products/get_24hr_stats.rs index a8ef310..9bb05c5 100644 --- a/src/products/get_24hr_stats.rs +++ b/src/products/get_24hr_stats.rs @@ -1,8 +1,9 @@ use hyper::Method; +use serde_derive::{Serialize, Deserialize}; -use serde_util::deserialize_from_str; -use rest_client::{EndPointRequest, RestRequest}; -use url::Route; +use crate::serde_util::deserialize_from_str; +use crate::rest_client::{EndPointRequest, RestRequest}; +use crate::url::Route; pub struct Get24hrStats { product_id: String, @@ -27,7 +28,7 @@ pub struct Stats { impl EndPointRequest for Get24hrStats { fn create_request(&self) -> RestRequest { RestRequest { - http_method: Method::Get, + http_method: Method::GET, route: Route::new() .add_segment(&"products") .add_segment(&self.product_id) @@ -48,7 +49,7 @@ mod tests { let result = Get24hrStats::new(String::from("BTC-USD")).create_request(); let expected = RestRequest { - http_method: Method::Get, + http_method: Method::GET, route: Route::new() .add_segment(&"products") .add_segment(&"BTC-USD") diff --git a/src/products/get_historic_rates.rs b/src/products/get_historic_rates.rs index 0c17f4c..c6f9afb 100644 --- a/src/products/get_historic_rates.rs +++ b/src/products/get_historic_rates.rs @@ -1,8 +1,10 @@ use chrono::{DateTime, Utc}; use hyper::Method; +use serde_derive::{Serialize, Deserialize}; -use rest_client::{EndPointRequest, RestRequest}; -use url::Route; + +use crate::rest_client::{EndPointRequest, RestRequest}; +use crate::url::Route; pub struct GetHistoricRates { product_id: String, @@ -41,7 +43,7 @@ pub struct Candle { impl EndPointRequest> for GetHistoricRates { fn create_request(&self) -> RestRequest { RestRequest { - http_method: Method::Get, + http_method: Method::GET, route: Route::new() .add_segment(&"products") .add_segment(&self.product_id) @@ -72,7 +74,7 @@ mod tests { ).create_request(); let expected = RestRequest { - http_method: Method::Get, + http_method: Method::GET, route: Route::new() .add_segment(&"products") .add_segment(&"BTC-USD") diff --git a/src/products/get_product_order_book.rs b/src/products/get_product_order_book.rs index 2c27736..b9bb8e0 100644 --- a/src/products/get_product_order_book.rs +++ b/src/products/get_product_order_book.rs @@ -1,8 +1,9 @@ use hyper::Method; +use serde_derive::{Serialize, Deserialize}; -use serde_util::deserialize_from_str; -use rest_client::{EndPointRequest, RestRequest}; -use url::Route; +use crate::serde_util::deserialize_from_str; +use crate::rest_client::{EndPointRequest, RestRequest}; +use crate::url::Route; /// This struct represent the endpoint `Get Product Order Book` /// (The level 3 requests are not implemented) @@ -44,7 +45,7 @@ pub struct PriceLevel { impl EndPointRequest> for GetProductOrderBook { fn create_request(&self) -> RestRequest { RestRequest { - http_method: Method::Get, + http_method: Method::GET, route: Route::new() .add_segment(&"products") .add_segment(&self.product_id) @@ -68,7 +69,7 @@ mod tests { let request_handler = GetProductOrderBook::new(String::from("BTC-USD"), Level::Level2); let result = request_handler.create_request(); let expected = RestRequest { - http_method: Method::Get, + http_method: Method::GET, route: Route::new() .add_segment(&"products") .add_segment(&"BTC-USD") diff --git a/src/products/get_product_ticker.rs b/src/products/get_product_ticker.rs index 056fa39..e8bf246 100644 --- a/src/products/get_product_ticker.rs +++ b/src/products/get_product_ticker.rs @@ -1,9 +1,12 @@ use hyper::Method; use chrono::{DateTime, Utc}; +use serde_derive::{Serialize, Deserialize}; + +use crate::serde_util::deserialize_from_str; +use crate::rest_client::{EndPointRequest, RestRequest}; +use crate::url::Route; + -use serde_util::deserialize_from_str; -use rest_client::{EndPointRequest, RestRequest}; -use url::Route; /// This struct represents the `Get Product Ticker` end point. /// @@ -37,7 +40,7 @@ pub struct Ticker { impl EndPointRequest for GetProductTicker { fn create_request(&self) -> RestRequest { RestRequest { - http_method: Method::Get, + http_method: Method::GET, route: Route::new() .add_segment(&"products") .add_segment(&self.product_id) @@ -59,7 +62,7 @@ mod tests { fn test_create_request() { let result = GetProductTicker::new(String::from("BTC-USD")).create_request(); let expected = RestRequest { - http_method: Method::Get, + http_method: Method::GET, route: Route::new() .add_segment(&"products") .add_segment(&"BTC-USD") diff --git a/src/products/get_products.rs b/src/products/get_products.rs index e475b01..361c68b 100644 --- a/src/products/get_products.rs +++ b/src/products/get_products.rs @@ -1,8 +1,9 @@ use hyper::Method; +use serde_derive::{Serialize, Deserialize}; -use serde_util::deserialize_from_str; -use rest_client::{EndPointRequest, RestRequest}; -use url::Route; +use crate::serde_util::deserialize_from_str; +use crate::rest_client::{EndPointRequest, RestRequest}; +use crate::url::Route; /// This struct is the request handler #[derive(Default)] @@ -32,7 +33,7 @@ pub struct Product { impl EndPointRequest> for GetProducts { fn create_request(&self) -> RestRequest { RestRequest { - http_method: Method::Get, + http_method: Method::GET, route: Route::new().add_segment(&"/products"), body: String::new(), } @@ -51,7 +52,7 @@ mod tests { let handler = GetProducts::new(); let expected = RestRequest { - http_method: Method::Get, + http_method: Method::GET, route: Route::new().add_segment(&"/products"), body: String::new(), }; diff --git a/src/products/get_trades.rs b/src/products/get_trades.rs index 5822369..c5060dd 100644 --- a/src/products/get_trades.rs +++ b/src/products/get_trades.rs @@ -1,10 +1,12 @@ // TODO : handle pagination use chrono::{DateTime, Utc}; use hyper::Method; +use serde_derive::{Serialize, Deserialize}; -use serde_util::deserialize_from_str; -use rest_client::{EndPointRequest, RestRequest}; -use url::Route; + +use crate::serde_util::deserialize_from_str; +use crate::rest_client::{EndPointRequest, RestRequest}; +use crate::url::Route; pub struct GetTrades { product_id: String, @@ -36,7 +38,7 @@ pub struct Trade { impl EndPointRequest> for GetTrades { fn create_request(&self) -> RestRequest { RestRequest { - http_method: Method::Get, + http_method: Method::GET, route: Route::new() .add_segment(&"products") .add_segment(&self.product_id) @@ -57,7 +59,7 @@ mod tests { fn test_create_request() { let result = GetTrades::new(String::from("BTC-USD")).create_request(); let expected = RestRequest { - http_method: Method::Get, + http_method: Method::GET, route: Route::new() .add_segment(&"products") .add_segment(&"BTC-USD") diff --git a/src/rest_client.rs b/src/rest_client.rs index 99b86d2..d0f71b4 100644 --- a/src/rest_client.rs +++ b/src/rest_client.rs @@ -2,18 +2,18 @@ use hyper; use serde::de; use serde_json; use hyper::{Body, Client, Method, Request, Uri}; -use hyper::header::{ContentLength, UserAgent}; +use hyper::header::{CONTENT_LENGTH, USER_AGENT, HeaderValue}; use hyper::client::HttpConnector; use hyper_tls::HttpsConnector; -use tokio_core::reactor::Handle; -use futures::{Future, Stream}; +use futures::{Future, Stream, TryFuture, TryFutureExt}; +use serde_derive::{Serialize, Deserialize}; -use url::Route; -use error::RestError; +use crate::url::Route; +use crate::error::RestError; const PUBLIC_API: &str = "https://api.gdax.com"; const SANDBOX_API: &str = "https://api-public.sandbox.gdax.com"; -const USER_AGENT: &str = concat!("gdax_rs/", env!("CARGO_PKG_VERSION")); +const USER_AGENT_VALUE: &str = concat!("gdax_rs/", env!("CARGO_PKG_VERSION")); pub struct RESTClient { api_url: String, @@ -24,10 +24,13 @@ pub struct RESTClient { impl RESTClient { /// Create a new `RESTClient` object with a specified API URL, for most cases, you should use /// `RESTClient::default` or `RESTClient::staging` to connect to GDAX - pub fn new(api_url: &str, handle: &Handle) -> Result { - let connector = HttpsConnector::new(4, handle) - .map_err(|e| RestError::HttpsConnectorError(e.to_string()))?; - let client = Client::configure().connector(connector).build(handle); + pub fn new(api_url: &str) -> Result { + let https = HttpsConnector::new(); + let client = Client::builder() + .build::<_, hyper::Body>(https); + // let connector = HttpsConnector::new(4, handle) + // .map_err(|e| RestError::HttpsConnectorError(e.to_string()))?; + // let client = Client::configure().connector(connector).build(handle); Ok(RESTClient { api_url: String::from(api_url), client, @@ -35,20 +38,20 @@ impl RESTClient { } /// Returns the default APIConnector (connected to the staging API) - pub fn default(handle: &Handle) -> RESTClient { - RESTClient::new(PUBLIC_API, handle).unwrap() + pub fn default() -> RESTClient { + RESTClient::new(PUBLIC_API).unwrap() } /// Returns the sandbox APIConnector (connected to the sandbox API) - pub fn sandbox(handle: &Handle) -> RESTClient { - RESTClient::new(SANDBOX_API, handle).unwrap() + pub fn sandbox() -> RESTClient { + RESTClient::new(SANDBOX_API).unwrap() } /// This method send a request to GDAX API and return the result as a `Future` - pub fn send_request( + pub async fn send_request( &mut self, - request: &EndPointRequest, - ) -> Box + 'static> { + request: &dyn EndPointRequest, + ) -> Result { let request = request.create_request(); // create the full request uri @@ -58,20 +61,39 @@ impl RESTClient { .unwrap(); // create request - let mut req = Request::new(request.http_method.clone(), uri); - req.headers_mut() - .set(ContentLength(request.body.len() as u64)); - req.set_body(request.body.clone()); + let mut req = Request::builder() + .method(request.http_method.clone()) + .uri(uri) + .header(USER_AGENT, HeaderValue::from_static(USER_AGENT_VALUE)) + // .header(CONTENT_LENGTH, HeaderValue::from_static(&request.body.len().to_string())) + .body(Body::from(request.body.clone())).unwrap(); + // .and_then(|res| res.body().concat2()) + // .and_then(|body| Ok(serde_json::from_slice(&body).unwrap())); + + + // req.headers_mut() + // .insert(CONTENT_LENGTH, HeaderValue::from_static(&request.body.len().to_string())); + // req.set_body(request.body.clone()); // set the user agent (required by the API) - req.headers_mut().set(UserAgent::new(USER_AGENT)); + // req.headers_mut().insert(USER_AGENT, HeaderValue::from_static(USER_AGENT_VALUE)); - let work = self.client - .request(req) - .and_then(|res| res.body().concat2()) - .and_then(|body| Ok(serde_json::from_slice(&body).unwrap())); + let client = Client::new(); - Box::new(work) + + // let work = self.client + let resp = client.request(req).await?; + + let body_bytes = hyper::body::to_bytes(resp.into_body()).await?; + + Ok(serde_json::from_slice(&body_bytes.to_vec()).unwrap()) + // .map_ok(|res| res.body().concat2()) + // .map_ok(hyper::body::to_bytes) + // .map_ok(|body| Ok(serde_json::from_slice(&body.body().to_string()).unwrap())); + + // Box::new(work) + + // resp } } @@ -91,7 +113,9 @@ pub trait EndPointRequest { // TODO: test error handling! #[cfg(test)] mod tests { + use tokio; use tokio_core::reactor::Core; + use serde_derive::{Serialize, Deserialize}; use mockito::{mock, SERVER_URL}; use hyper::Method; @@ -108,25 +132,25 @@ mod tests { impl EndPointRequest for FakeRequestHandler { fn create_request(&self) -> RestRequest { RestRequest { - http_method: Method::Get, + http_method: Method::GET, route: Route::new().add_segment(&"test"), body: String::from(""), } } } - #[test] - fn test_fake_request() { + #[tokio::test] + async fn test_fake_request() { let _m = mock("GET", "/test").with_body("{\"value\": 1}").create(); let mut core = Core::new().unwrap(); - let handle = core.handle(); + // let handle = core.handle(); - let mut test_client = RESTClient::new(SERVER_URL, &handle).unwrap(); + let mut test_client = RESTClient::new(SERVER_URL).unwrap(); let request = FakeRequestHandler {}; - let future = test_client.send_request(&request); + let value = test_client.send_request(&request).await.unwrap(); - let value = core.run(future).unwrap(); + // let value = core.run(future).unwrap(); assert_eq!(value.value, 1); } diff --git a/src/time.rs b/src/time.rs index 5fd40ec..7b0d108 100644 --- a/src/time.rs +++ b/src/time.rs @@ -3,9 +3,10 @@ use hyper::Method; use chrono::{DateTime, Utc}; +use serde_derive::{Serialize, Deserialize}; -use rest_client::{EndPointRequest, RestRequest}; -use url::Route; +use crate::rest_client::{EndPointRequest, RestRequest}; +use crate::url::Route; #[derive(Default)] pub struct GetTime; @@ -25,7 +26,7 @@ pub struct Time { impl EndPointRequest