Switch ureq with reqwest
This commit is contained in:
parent
772f9ccc21
commit
4f36d2dce1
687
Cargo.lock
generated
687
Cargo.lock
generated
@ -2,6 +2,15 @@
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "addr2line"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678"
|
||||
dependencies = [
|
||||
"gimli",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "adler"
|
||||
version = "1.0.2"
|
||||
@ -92,12 +101,33 @@ dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atomic-waker"
|
||||
version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
|
||||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
version = "0.3.73"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a"
|
||||
dependencies = [
|
||||
"addr2line",
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"miniz_oxide",
|
||||
"object",
|
||||
"rustc-demangle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.22.1"
|
||||
@ -141,6 +171,12 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
|
||||
|
||||
[[package]]
|
||||
name = "bytecount"
|
||||
version = "0.6.8"
|
||||
@ -153,6 +189,12 @@ version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
|
||||
|
||||
[[package]]
|
||||
name = "bzip2"
|
||||
version = "0.4.4"
|
||||
@ -323,6 +365,22 @@ version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.2.12"
|
||||
@ -503,6 +561,12 @@ dependencies = [
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a"
|
||||
|
||||
[[package]]
|
||||
name = "flatbuffers"
|
||||
version = "24.3.25"
|
||||
@ -532,6 +596,27 @@ dependencies = [
|
||||
"miniz_oxide",
|
||||
]
|
||||
|
||||
[[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.2.1"
|
||||
@ -679,6 +764,12 @@ dependencies = [
|
||||
"typed-builder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gimli"
|
||||
version = "0.29.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd"
|
||||
|
||||
[[package]]
|
||||
name = "globset"
|
||||
version = "0.4.14"
|
||||
@ -703,6 +794,25 @@ dependencies = [
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "h2"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab"
|
||||
dependencies = [
|
||||
"atomic-waker",
|
||||
"bytes",
|
||||
"fnv",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"http",
|
||||
"indexmap",
|
||||
"slab",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.14.5"
|
||||
@ -736,12 +846,125 @@ dependencies = [
|
||||
"digest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
"itoa",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http-body"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"http",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http-body-util"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-util",
|
||||
"http",
|
||||
"http-body",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "httparse"
|
||||
version = "1.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9"
|
||||
|
||||
[[package]]
|
||||
name = "humantime"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4fe55fb7a772d59a5ff1dfbff4fe0258d19b89fec4b233e75d35d5d2316badc"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
"h2",
|
||||
"http",
|
||||
"http-body",
|
||||
"httparse",
|
||||
"itoa",
|
||||
"pin-project-lite",
|
||||
"smallvec",
|
||||
"tokio",
|
||||
"want",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper-rustls"
|
||||
version = "0.27.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155"
|
||||
dependencies = [
|
||||
"futures-util",
|
||||
"http",
|
||||
"hyper",
|
||||
"hyper-util",
|
||||
"rustls",
|
||||
"rustls-pki-types",
|
||||
"tokio",
|
||||
"tokio-rustls",
|
||||
"tower-service",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper-tls"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"http-body-util",
|
||||
"hyper",
|
||||
"hyper-util",
|
||||
"native-tls",
|
||||
"tokio",
|
||||
"tokio-native-tls",
|
||||
"tower-service",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper-util"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ab92f4f49ee4fb4f997c784b7a2e0fa70050211e0b6a287f898c3c9785ca956"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
"http",
|
||||
"http-body",
|
||||
"hyper",
|
||||
"pin-project-lite",
|
||||
"socket2",
|
||||
"tokio",
|
||||
"tower",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.5.0"
|
||||
@ -799,6 +1022,12 @@ version = "0.3.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f958d3d68f4167080a18141e10381e7634563984a537f2a49a30fd8e53ac5767"
|
||||
|
||||
[[package]]
|
||||
name = "ipnet"
|
||||
version = "2.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3"
|
||||
|
||||
[[package]]
|
||||
name = "is_terminal_polyfill"
|
||||
version = "1.70.0"
|
||||
@ -829,6 +1058,15 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy-regex"
|
||||
version = "3.1.0"
|
||||
@ -894,6 +1132,12 @@ version = "2.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
||||
|
||||
[[package]]
|
||||
name = "mime"
|
||||
version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
|
||||
|
||||
[[package]]
|
||||
name = "minimal-lexical"
|
||||
version = "0.2.1"
|
||||
@ -909,6 +1153,34 @@ dependencies = [
|
||||
"adler",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "0.8.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"wasi",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "native-tls"
|
||||
version = "0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"openssl",
|
||||
"openssl-probe",
|
||||
"openssl-sys",
|
||||
"schannel",
|
||||
"security-framework",
|
||||
"security-framework-sys",
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "7.1.3"
|
||||
@ -950,12 +1222,65 @@ dependencies = [
|
||||
"libm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
||||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
version = "0.10.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f"
|
||||
dependencies = [
|
||||
"bitflags 2.5.0",
|
||||
"cfg-if",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"openssl-macros",
|
||||
"openssl-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openssl-macros"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
|
||||
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.102"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"pkg-config",
|
||||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "osrm-backend"
|
||||
version = "0.1.0"
|
||||
@ -971,10 +1296,10 @@ dependencies = [
|
||||
"geo-types",
|
||||
"help",
|
||||
"log",
|
||||
"reqwest",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"toml",
|
||||
"ureq",
|
||||
"xml-builder",
|
||||
"zip-extract",
|
||||
]
|
||||
@ -1138,6 +1463,50 @@ version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
|
||||
|
||||
[[package]]
|
||||
name = "reqwest"
|
||||
version = "0.12.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bytes",
|
||||
"encoding_rs",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"h2",
|
||||
"http",
|
||||
"http-body",
|
||||
"http-body-util",
|
||||
"hyper",
|
||||
"hyper-rustls",
|
||||
"hyper-tls",
|
||||
"hyper-util",
|
||||
"ipnet",
|
||||
"js-sys",
|
||||
"log",
|
||||
"mime",
|
||||
"native-tls",
|
||||
"once_cell",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"rustls-pemfile",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"sync_wrapper",
|
||||
"system-configuration",
|
||||
"tokio",
|
||||
"tokio-native-tls",
|
||||
"tower-service",
|
||||
"url",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
"winreg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ring"
|
||||
version = "0.17.8"
|
||||
@ -1153,6 +1522,12 @@ dependencies = [
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.4.0"
|
||||
@ -1177,18 +1552,27 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.22.4"
|
||||
version = "0.23.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432"
|
||||
checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402"
|
||||
dependencies = [
|
||||
"log",
|
||||
"ring",
|
||||
"once_cell",
|
||||
"rustls-pki-types",
|
||||
"rustls-webpki",
|
||||
"subtle",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-pemfile"
|
||||
version = "2.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"rustls-pki-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-pki-types"
|
||||
version = "1.7.0"
|
||||
@ -1221,6 +1605,15 @@ dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "schannel"
|
||||
version = "0.1.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534"
|
||||
dependencies = [
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sealed"
|
||||
version = "0.5.0"
|
||||
@ -1233,6 +1626,29 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "security-framework"
|
||||
version = "2.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0"
|
||||
dependencies = [
|
||||
"bitflags 2.5.0",
|
||||
"core-foundation",
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
"security-framework-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "security-framework-sys"
|
||||
version = "2.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.23"
|
||||
@ -1279,6 +1695,18 @@ dependencies = [
|
||||
"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 = "sha1"
|
||||
version = "0.10.6"
|
||||
@ -1342,6 +1770,16 @@ version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c"
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.5.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spin"
|
||||
version = "0.9.8"
|
||||
@ -1371,6 +1809,12 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sync_wrapper"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394"
|
||||
|
||||
[[package]]
|
||||
name = "synthez"
|
||||
version = "0.3.1"
|
||||
@ -1404,6 +1848,39 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "system-configuration"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"core-foundation",
|
||||
"system-configuration-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "system-configuration-sys"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"fastrand",
|
||||
"rustix",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "terminal_size"
|
||||
version = "0.3.0"
|
||||
@ -1470,6 +1947,55 @@ version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.38.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
"libc",
|
||||
"mio",
|
||||
"pin-project-lite",
|
||||
"socket2",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-native-tls"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
|
||||
dependencies = [
|
||||
"native-tls",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-rustls"
|
||||
version = "0.26.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4"
|
||||
dependencies = [
|
||||
"rustls",
|
||||
"rustls-pki-types",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-util"
|
||||
version = "0.7.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.8.14"
|
||||
@ -1504,6 +2030,33 @@ dependencies = [
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower"
|
||||
version = "0.4.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"pin-project",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower-layer"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0"
|
||||
|
||||
[[package]]
|
||||
name = "tower-service"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52"
|
||||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
version = "0.1.40"
|
||||
@ -1561,6 +2114,12 @@ dependencies = [
|
||||
"tracing-log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "try-lock"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
|
||||
|
||||
[[package]]
|
||||
name = "typed-builder"
|
||||
version = "0.15.2"
|
||||
@ -1626,24 +2185,6 @@ version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
|
||||
|
||||
[[package]]
|
||||
name = "ureq"
|
||||
version = "2.9.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d11a831e3c0b56e438a28308e7c810799e3c118417f342d30ecec080105395cd"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"encoding_rs",
|
||||
"flate2",
|
||||
"log",
|
||||
"once_cell",
|
||||
"rustls",
|
||||
"rustls-pki-types",
|
||||
"rustls-webpki",
|
||||
"url",
|
||||
"webpki-roots",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "2.5.2"
|
||||
@ -1667,6 +2208,12 @@ version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
|
||||
|
||||
[[package]]
|
||||
name = "vcpkg"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
@ -1683,6 +2230,15 @@ dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "want"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
|
||||
dependencies = [
|
||||
"try-lock",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.0+wasi-snapshot-preview1"
|
||||
@ -1690,12 +2246,79 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "0.26.3"
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd"
|
||||
checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8"
|
||||
dependencies = [
|
||||
"rustls-pki-types",
|
||||
"cfg-if",
|
||||
"wasm-bindgen-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"log",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.42"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1877,6 +2500,16 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winreg"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xml-builder"
|
||||
version = "0.5.2"
|
||||
|
@ -14,9 +14,9 @@ futures = "0.3.30"
|
||||
geo-types = "0.7.13"
|
||||
help = "0.0.0"
|
||||
log = "0.4.21"
|
||||
reqwest = {version = "0.12.5", features = ["blocking"] }
|
||||
serde = { version = "1.0.203", features = ["serde_derive"] }
|
||||
serde_json = "1.0.118"
|
||||
ureq = { version = "2.9.7", features = ["charset"] }
|
||||
xml-builder = "0.5.2"
|
||||
|
||||
[[test]]
|
||||
@ -31,7 +31,7 @@ debug = true
|
||||
|
||||
[build-dependencies]
|
||||
flatc-rust = "0.2.0"
|
||||
reqwest = {version = "0.12.5", features = ["blocking"] }
|
||||
serde = { version = "1.0.203", features = ["serde_derive"] }
|
||||
toml = "0.8.14"
|
||||
ureq = { version = "2.9.7", features = ["charset"] }
|
||||
zip-extract = "0.1.3"
|
||||
|
26
build.rs
26
build.rs
@ -2,11 +2,9 @@ use std::env;
|
||||
use std::fmt::Display;
|
||||
use std::io::Cursor;
|
||||
use std::path::PathBuf;
|
||||
use std::time::Duration;
|
||||
use std::{collections::HashMap, path::Path};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ureq::AgentBuilder;
|
||||
|
||||
macro_rules! build_println {
|
||||
($($tokens: tt)*) => {
|
||||
@ -74,19 +72,13 @@ fn main() {
|
||||
|
||||
if !Path::new(executable_path).exists() {
|
||||
build_println!("downloading flatc executable from {url}");
|
||||
let agent = AgentBuilder::new()
|
||||
.timeout_read(Duration::from_secs(5))
|
||||
.timeout_write(Duration::from_secs(5))
|
||||
.build();
|
||||
|
||||
let call = agent.get(&url).call();
|
||||
let mut reader = match call {
|
||||
Ok(response) => response.into_reader(),
|
||||
Err(e) => panic!("http error: {e}"),
|
||||
let response = match reqwest::blocking::get(url) {
|
||||
Ok(response) => response,
|
||||
Err(e) => panic!("network error during build: {e}"),
|
||||
};
|
||||
let mut archive = Vec::new();
|
||||
if let Err(e) = reader.read_to_end(&mut archive) {
|
||||
panic!("cannot read from stream: {e}");
|
||||
let archive = match response.bytes() {
|
||||
Ok(archive) => archive,
|
||||
Err(e) => panic!("could not retrieve byte stream during build: {e}"),
|
||||
};
|
||||
let target_dir = PathBuf::from("target");
|
||||
zip_extract::extract(Cursor::new(archive), &target_dir, true)
|
||||
@ -99,13 +91,13 @@ fn main() {
|
||||
}
|
||||
|
||||
let (flatc, location) = match Path::new(executable_path).exists() {
|
||||
true => (flatc_rust::Flatc::from_path(executable_path), "local"),
|
||||
false => (flatc_rust::Flatc::from_env_path(), "downloaded"),
|
||||
true => (flatc_rust::Flatc::from_path(executable_path), "downloaded"),
|
||||
false => (flatc_rust::Flatc::from_env_path(), "locally installed"),
|
||||
};
|
||||
assert!(flatc.check().is_ok());
|
||||
let version = &flatc.version().unwrap();
|
||||
build_println!(
|
||||
"using {location} flatc v{} to compile schema files",
|
||||
"using {location} flatc v{} to compile schema files ({executable_path})",
|
||||
version.version()
|
||||
);
|
||||
flatc
|
||||
|
@ -3,8 +3,8 @@ pub fn approx_equal(a: f32, b: f32, dp: u8) -> bool {
|
||||
(a - b).abs() < p
|
||||
}
|
||||
|
||||
pub fn aprox_equal_within_percentage_range(actual: f64, expectation: f64, percentage: u8) -> bool {
|
||||
assert!(percentage <= 100);
|
||||
pub fn aprox_equal_within_percentage_range(actual: f64, expectation: f64, percentage: f64) -> bool {
|
||||
assert!(percentage.is_sign_positive() && percentage <= 100.);
|
||||
let factor = 0.01 * percentage as f64;
|
||||
actual >= expectation - (factor * expectation) && actual <= expectation + (factor * expectation)
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ pub mod location;
|
||||
pub mod nearest_response;
|
||||
pub mod osm;
|
||||
pub mod osm_db;
|
||||
pub mod osrm_error;
|
||||
pub mod osrm_world;
|
||||
pub mod route_response;
|
||||
pub mod scenario_id;
|
||||
|
@ -1,17 +1,20 @@
|
||||
use super::{
|
||||
nearest_response::NearestResponse, osm::OSMNode, osm_db::OSMDb, route_response::RouteResponse,
|
||||
nearest_response::NearestResponse, osm::OSMNode, osm_db::OSMDb, osrm_error::OSRMError,
|
||||
route_response::RouteResponse,
|
||||
};
|
||||
use crate::{common::local_task::LocalTask, Location};
|
||||
use core::panic;
|
||||
use cucumber::World;
|
||||
use log::debug;
|
||||
use reqwest::StatusCode;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
fs::{create_dir_all, File},
|
||||
io::Write,
|
||||
io::{Read, Write},
|
||||
path::PathBuf,
|
||||
time::Duration,
|
||||
};
|
||||
// use ureq::Error;
|
||||
|
||||
const DEFAULT_ORIGIN: Location = Location {
|
||||
longitude: 1.0f32,
|
||||
@ -37,13 +40,15 @@ pub struct OSRMWorld {
|
||||
|
||||
pub request_with_flatbuffers: bool,
|
||||
pub query_options: HashMap<String, String>,
|
||||
pub request_string: Option<String>,
|
||||
|
||||
pub grid_size: f32,
|
||||
pub origin: Location,
|
||||
pub way_spacing: f32,
|
||||
|
||||
task: LocalTask,
|
||||
agent: ureq::Agent,
|
||||
client: reqwest::blocking::Client,
|
||||
// agent: ureq::Agent,
|
||||
}
|
||||
|
||||
impl Default for OSRMWorld {
|
||||
@ -66,15 +71,22 @@ impl Default for OSRMWorld {
|
||||
("alternatives".into(), "false".into()),
|
||||
("annotations".into(), "true".into()),
|
||||
]),
|
||||
request_string: Default::default(),
|
||||
|
||||
grid_size: DEFAULT_GRID_SIZE,
|
||||
origin: DEFAULT_ORIGIN,
|
||||
way_spacing: WAY_SPACING,
|
||||
task: LocalTask::default(),
|
||||
agent: ureq::AgentBuilder::new()
|
||||
.timeout_read(Duration::from_secs(5))
|
||||
.timeout_write(Duration::from_secs(5))
|
||||
.build(),
|
||||
// agent: ureq::AgentBuilder::new()
|
||||
// .timeout_read(Duration::from_secs(5))
|
||||
// .timeout_write(Duration::from_secs(5))
|
||||
// .build(),
|
||||
client: reqwest::blocking::Client::builder()
|
||||
.connect_timeout(Duration::from_secs(5))
|
||||
.no_proxy()
|
||||
.http1_only()
|
||||
.build()
|
||||
.unwrap(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -222,8 +234,7 @@ impl OSRMWorld {
|
||||
pub fn nearest(
|
||||
&mut self,
|
||||
query_location: &Location,
|
||||
// request_with_flatbuffers: bool,
|
||||
) -> NearestResponse {
|
||||
) -> Result<(u16, NearestResponse), (u16, OSRMError)> {
|
||||
self.start_routed();
|
||||
|
||||
let mut url = format!(
|
||||
@ -234,33 +245,45 @@ impl OSRMWorld {
|
||||
url += ".flatbuffers";
|
||||
}
|
||||
|
||||
if !self.query_options.is_empty() {
|
||||
let options = self
|
||||
.query_options
|
||||
.iter()
|
||||
.map(|(key, value)| format!("{key}={value}"))
|
||||
.collect::<Vec<String>>()
|
||||
.join("&");
|
||||
url += "?";
|
||||
url += &options;
|
||||
}
|
||||
|
||||
// panic!("url: {url}");
|
||||
let call = self.agent.get(&url).call();
|
||||
|
||||
let body = match call {
|
||||
Ok(response) => response.into_reader(),
|
||||
let response = match self.client.get(url).send() {
|
||||
Ok(response) => response,
|
||||
Err(e) => panic!("http error: {e}"),
|
||||
};
|
||||
let status = response.status();
|
||||
let bytes = &response.bytes().unwrap()[..];
|
||||
|
||||
let response = match self.request_with_flatbuffers {
|
||||
true => NearestResponse::from_flatbuffer(body),
|
||||
false => NearestResponse::from_json_reader(body),
|
||||
};
|
||||
response
|
||||
match status {
|
||||
StatusCode::OK => {
|
||||
let response = match self.request_with_flatbuffers {
|
||||
true => NearestResponse::from_flatbuffer(bytes),
|
||||
false => NearestResponse::from_json_reader(bytes),
|
||||
};
|
||||
return Ok((status.as_u16(), response));
|
||||
}
|
||||
_ => {
|
||||
return Err((status.as_u16(), OSRMError::from_json_reader(bytes)));
|
||||
}
|
||||
}
|
||||
|
||||
// match call {
|
||||
// Ok(response) => {
|
||||
// let response = match self.request_with_flatbuffers {
|
||||
// true => NearestResponse::from_flatbuffer(response.into_reader()),
|
||||
// false => NearestResponse::from_json_reader(response.into_reader()),
|
||||
// };
|
||||
// Ok((200u16, response))
|
||||
// }
|
||||
// Err(Error::Status(code, response)) => {
|
||||
// return Err((code, OSRMError::from_json_reader(response.into_reader())));
|
||||
// }
|
||||
// Err(e) => panic!("http error: {e}"),
|
||||
// }
|
||||
}
|
||||
|
||||
pub fn route(&mut self, waypoints: &[Location]) -> RouteResponse {
|
||||
pub fn route(
|
||||
&mut self,
|
||||
waypoints: &[Location],
|
||||
) -> Result<(u16, RouteResponse), (u16, OSRMError)> {
|
||||
self.start_routed();
|
||||
|
||||
let waypoint_string = waypoints
|
||||
@ -269,36 +292,80 @@ impl OSRMWorld {
|
||||
.collect::<Vec<String>>()
|
||||
.join(";");
|
||||
|
||||
let mut url = format!(
|
||||
"http://localhost:5000/route/v1/{}/{waypoint_string}",
|
||||
self.profile,
|
||||
);
|
||||
if self.request_with_flatbuffers {
|
||||
url += ".flatbuffers";
|
||||
}
|
||||
if !self.query_options.is_empty() {
|
||||
let options = self
|
||||
.query_options
|
||||
.iter()
|
||||
.map(|(key, value)| format!("{key}={value}"))
|
||||
.collect::<Vec<String>>()
|
||||
.join("&");
|
||||
url += "?";
|
||||
url += &options;
|
||||
}
|
||||
let url = match &self.request_string {
|
||||
None => {
|
||||
let mut url = format!(
|
||||
"http://localhost:5000/route/v1/{}/{waypoint_string}",
|
||||
self.profile,
|
||||
);
|
||||
if self.request_with_flatbuffers {
|
||||
url += ".flatbuffers";
|
||||
}
|
||||
if !self.query_options.is_empty() {
|
||||
let options = self
|
||||
.query_options
|
||||
.iter()
|
||||
.map(|(key, value)| format!("{key}={value}"))
|
||||
.collect::<Vec<String>>()
|
||||
.join("&");
|
||||
url += "?";
|
||||
url += &options;
|
||||
}
|
||||
url
|
||||
}
|
||||
Some(request_string) => {
|
||||
let temp = format!("http://localhost:5000/{}", request_string);
|
||||
// if request_string == "?" {
|
||||
// panic!("s: {temp}");
|
||||
// }
|
||||
temp
|
||||
}
|
||||
};
|
||||
// println!("url: {url}");
|
||||
let call = self.agent.get(&url).call();
|
||||
|
||||
let body = match call {
|
||||
Ok(response) => response.into_reader(),
|
||||
Err(_e) => return RouteResponse::default(),
|
||||
// let request = self.agent.get(&url);
|
||||
// if url.ends_with("?") {
|
||||
// // request = request.query("", "");
|
||||
// }
|
||||
// let call = request.call();
|
||||
let response = match self.client.get(url).send() {
|
||||
Ok(response) => response,
|
||||
Err(e) => panic!("http error: {e}"),
|
||||
};
|
||||
let status = &response.status();
|
||||
|
||||
let text = std::io::read_to_string(body).unwrap();
|
||||
let response = match self.request_with_flatbuffers {
|
||||
true => unimplemented!("RouteResponse::from_flatbuffer(body)"),
|
||||
false => RouteResponse::from_string(&text),
|
||||
};
|
||||
response
|
||||
match *status {
|
||||
StatusCode::OK => {
|
||||
let text = response.text().unwrap();
|
||||
let response = match self.request_with_flatbuffers {
|
||||
true => unimplemented!("RouteResponse::from_flatbuffer(body)"),
|
||||
false => RouteResponse::from_string(&text),
|
||||
};
|
||||
Ok((status.as_u16(), response))
|
||||
}
|
||||
_ => {
|
||||
let bytes = &response.bytes().unwrap()[..];
|
||||
return Err((status.as_u16(), OSRMError::from_json_reader(bytes)));
|
||||
}
|
||||
}
|
||||
|
||||
// match call {
|
||||
// Ok(response) => {
|
||||
// let text = std::io::read_to_string(response.into_reader()).unwrap();
|
||||
// let response = match self.request_with_flatbuffers {
|
||||
// true => unimplemented!("RouteResponse::from_flatbuffer(body)"),
|
||||
// false => RouteResponse::from_string(&text),
|
||||
// };
|
||||
// Ok((200u16, response))
|
||||
// }
|
||||
// Err(Error::Status(code, response)) => {
|
||||
// let result = Err((code, OSRMError::from_json_reader(response.into_reader())));
|
||||
// if url.ends_with("?") {
|
||||
// panic!("{url} {result:?}");
|
||||
// }
|
||||
|
||||
// return result;
|
||||
// }
|
||||
// Err(e) => panic!("http error: {e}"),
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
@ -84,6 +84,7 @@ impl RouteResponse {
|
||||
}
|
||||
|
||||
pub fn from_string(input: &str) -> Self {
|
||||
// println!("{input}");
|
||||
let response = match serde_json::from_str(input) {
|
||||
Ok(response) => response,
|
||||
Err(e) => panic!("parsing error {e} => {input}"),
|
||||
|
@ -12,7 +12,7 @@ use common::{
|
||||
location::Location,
|
||||
osm::OSMWay,
|
||||
osrm_world::OSRMWorld,
|
||||
route_response,
|
||||
route_response::{self, RouteResponse},
|
||||
};
|
||||
use core::panic;
|
||||
use cucumber::{
|
||||
@ -238,7 +238,6 @@ fn parse_table_from_steps(table: &Option<&Table>) -> (Vec<String>, Vec<HashMap<S
|
||||
#[when(regex = r"^I request nearest( with flatbuffers|) I should get$")]
|
||||
fn request_nearest(world: &mut OSRMWorld, step: &Step, state: String) {
|
||||
world.request_with_flatbuffers = state == " with flatbuffers";
|
||||
|
||||
world.write_osm_file();
|
||||
world.extract_osm_file();
|
||||
|
||||
@ -256,7 +255,7 @@ fn request_nearest(world: &mut OSRMWorld, step: &Step, state: String) {
|
||||
.expect("node name is one char long"),
|
||||
);
|
||||
|
||||
let response = world.nearest(&query_location);
|
||||
let nearest_result = world.nearest(&query_location);
|
||||
|
||||
let expected_location = &world.get_location(
|
||||
test_case
|
||||
@ -268,6 +267,10 @@ fn request_nearest(world: &mut OSRMWorld, step: &Step, state: String) {
|
||||
);
|
||||
|
||||
if test_case.contains_key("out") {
|
||||
assert!(nearest_result.is_ok());
|
||||
let (_, response) = nearest_result
|
||||
.as_ref()
|
||||
.expect("did not yield a nearest response");
|
||||
// check that result node is (approximately) equivalent
|
||||
let result_location = response.waypoints[0].location();
|
||||
assert!(approx_equal(
|
||||
@ -282,6 +285,10 @@ fn request_nearest(world: &mut OSRMWorld, step: &Step, state: String) {
|
||||
));
|
||||
}
|
||||
if test_case.contains_key("data_version") {
|
||||
assert!(nearest_result.is_ok());
|
||||
let (_, response) = nearest_result
|
||||
.as_ref()
|
||||
.expect("did not yield a nearest response");
|
||||
assert_eq!(
|
||||
test_case.get("data_version"),
|
||||
response.data_version.as_ref()
|
||||
@ -337,17 +344,14 @@ fn routability(world: &mut OSRMWorld, step: &Step) {
|
||||
.filter(|(title, _)| supported_headers.contains(title.as_str()))
|
||||
.for_each(|(title, expectation)| {
|
||||
let forward = title.starts_with("forw");
|
||||
// println!("{direction}: >{expectation}<");
|
||||
let response = match forward {
|
||||
let route_result = match forward {
|
||||
true => world.route(&vec![source, target]),
|
||||
false => world.route(&vec![target, source]),
|
||||
};
|
||||
let (_, response) = route_result
|
||||
.as_ref()
|
||||
.expect("osrm-routed returned an unexpected error");
|
||||
if expectation.is_empty() {
|
||||
// if !response.routes.is_empty() {
|
||||
// println!("> {title} {expectation}");
|
||||
// println!("{response:?}");
|
||||
// }
|
||||
|
||||
assert!(
|
||||
response.routes.is_empty()
|
||||
|| response.routes.first().unwrap().distance == 0.,
|
||||
@ -379,7 +383,7 @@ fn routability(world: &mut OSRMWorld, step: &Step) {
|
||||
let route = response.routes.first().unwrap();
|
||||
let actual_rate = route.distance / route.weight;
|
||||
assert!(
|
||||
aprox_equal_within_percentage_range(actual_rate, expected_rate, 1),
|
||||
aprox_equal_within_percentage_range(actual_rate, expected_rate, 1.),
|
||||
"{actual_rate} and {expected_rate} differ by more than 1%"
|
||||
);
|
||||
} else {
|
||||
@ -390,7 +394,7 @@ fn routability(world: &mut OSRMWorld, step: &Step) {
|
||||
// unimplemented!("{test_cases:#?}");
|
||||
}
|
||||
|
||||
fn extract_number_and_offset(unit: &str, expectation: &str) -> (f64, u8) {
|
||||
fn extract_number_and_offset(unit: &str, expectation: &str) -> (f64, f64) {
|
||||
let tokens: Vec<_> = expectation
|
||||
.split(unit)
|
||||
.map(|token| token.trim())
|
||||
@ -401,9 +405,10 @@ fn extract_number_and_offset(unit: &str, expectation: &str) -> (f64, u8) {
|
||||
.parse::<f64>()
|
||||
.expect("{expectation} needs to define a speed");
|
||||
let offset = match tokens.len() {
|
||||
1 => 5u8, // TODO: the JS fuzzy matcher has a default margin of 5% for absolute comparsions. This is imprecise
|
||||
1 => 5., // TODO: the JS fuzzy matcher has a default margin of 5% for absolute comparsions. This is imprecise
|
||||
2 => tokens[1]
|
||||
.replace("+-", "")
|
||||
.replace("~", "")
|
||||
.replace("+-", "")
|
||||
.trim()
|
||||
.parse()
|
||||
.expect(&format!("{} needs to specify a number", tokens[1])),
|
||||
@ -444,14 +449,15 @@ fn extract_number_vector_and_offset(unit: &str, expectation: &str) -> (Vec<f64>,
|
||||
(numbers, offset)
|
||||
}
|
||||
|
||||
enum WaypointsOrLocation {
|
||||
pub enum WaypointsOrLocation {
|
||||
Waypoints,
|
||||
Locations,
|
||||
// Undefined,
|
||||
Undefined,
|
||||
}
|
||||
|
||||
pub fn get_location_specification(test_case: &HashMap<String, String>) -> WaypointsOrLocation {
|
||||
assert!(
|
||||
test_case.contains_key("request") ||
|
||||
test_case.contains_key("from")
|
||||
&& test_case.contains_key("to")
|
||||
&& !test_case.contains_key("waypoints")
|
||||
@ -461,6 +467,10 @@ pub fn get_location_specification(test_case: &HashMap<String, String>) -> Waypoi
|
||||
"waypoints need to be specified by either from/to columns or a waypoint column, but not both"
|
||||
);
|
||||
|
||||
if test_case.contains_key("request") {
|
||||
return WaypointsOrLocation::Undefined;
|
||||
}
|
||||
|
||||
if test_case.contains_key("from")
|
||||
&& test_case.contains_key("to")
|
||||
&& !test_case.contains_key("waypoints")
|
||||
@ -528,6 +538,11 @@ fn request_route(world: &mut OSRMWorld, step: &Step, state: String) {
|
||||
.expect("to node name is one char long"),
|
||||
);
|
||||
vec![from_location, to_location]
|
||||
},
|
||||
WaypointsOrLocation::Undefined => {
|
||||
world.request_string = test_case.get("request").cloned();
|
||||
// println!("setting request to: {:?}", world.request_string);
|
||||
vec![]
|
||||
}
|
||||
};
|
||||
|
||||
@ -538,14 +553,18 @@ fn request_route(world: &mut OSRMWorld, step: &Step, state: String) {
|
||||
.insert("bearings".into(), bearings.replace(" ", ";"));
|
||||
}
|
||||
|
||||
let response = world.route(&waypoints);
|
||||
let route_result = world.route(&waypoints);
|
||||
|
||||
test_case
|
||||
.iter()
|
||||
.map(|(column_title, expectation)| (column_title.as_str(), expectation.as_str()))
|
||||
.for_each(|(case, expectation)| match case {
|
||||
"from" | "to" | "bearings" | "waypoints" | "#" => {}, // ignore input and comment columns
|
||||
"from" | "to" | "bearings" | "request" | "waypoints" | "#" => {}, // ignore input and comment columns
|
||||
"route" => {
|
||||
let response = match route_result.as_ref() {
|
||||
Ok((_, response)) => response,
|
||||
Err(_) => &RouteResponse::default(),
|
||||
};
|
||||
let route = if expectation.is_empty() {
|
||||
assert!(response.routes.is_empty());
|
||||
String::new()
|
||||
@ -570,6 +589,7 @@ fn request_route(world: &mut OSRMWorld, step: &Step, state: String) {
|
||||
assert_eq!(expectation, route);
|
||||
},
|
||||
"pronunciations" => {
|
||||
let (_, response) = route_result.as_ref().expect("osrm-routed returned an unexpected error");
|
||||
let pronunciations = response
|
||||
.routes
|
||||
.first()
|
||||
@ -588,6 +608,7 @@ fn request_route(world: &mut OSRMWorld, step: &Step, state: String) {
|
||||
assert_eq!(expectation, pronunciations);
|
||||
},
|
||||
"ref" => {
|
||||
let (_, response) = route_result.as_ref().expect("osrm-routed returned an unexpected error");
|
||||
let refs = response
|
||||
.routes
|
||||
.first()
|
||||
@ -606,6 +627,7 @@ fn request_route(world: &mut OSRMWorld, step: &Step, state: String) {
|
||||
assert_eq!(expectation, refs);
|
||||
},
|
||||
"speed" => {
|
||||
let (_, response) = route_result.as_ref().expect("osrm-routed returned an unexpected error");
|
||||
let route = response.routes.first().expect("no route returned");
|
||||
let actual_speed = route.distance / route.duration * 3.6;
|
||||
let (expected_speed, offset) = extract_number_and_offset("km/h", expectation);
|
||||
@ -616,6 +638,7 @@ fn request_route(world: &mut OSRMWorld, step: &Step, state: String) {
|
||||
);
|
||||
},
|
||||
"modes" => {
|
||||
let (_, response) = route_result.as_ref().expect("osrm-routed returned an unexpected error");
|
||||
let route = response.routes.first().expect("no route returned");
|
||||
let actual_modes = route
|
||||
.legs
|
||||
@ -632,6 +655,7 @@ fn request_route(world: &mut OSRMWorld, step: &Step, state: String) {
|
||||
assert_eq!(actual_modes, expectation);
|
||||
},
|
||||
"turns" => {
|
||||
let (_, response) = route_result.as_ref().expect("osrm-routed returned an unexpected error");
|
||||
let route = response.routes.first().expect("no route returned");
|
||||
let actual_turns = route
|
||||
.legs
|
||||
@ -660,6 +684,7 @@ fn request_route(world: &mut OSRMWorld, step: &Step, state: String) {
|
||||
assert_eq!(actual_turns, expectation);
|
||||
},
|
||||
"time" => {
|
||||
let (_, response) = route_result.as_ref().expect("osrm-routed returned an unexpected error");
|
||||
let actual_time = response.routes.first().expect("no route returned").duration;
|
||||
let (expected_time, offset) = extract_number_and_offset("s", expectation);
|
||||
// println!("{actual_time} == {expected_time} +- {offset}");
|
||||
@ -670,12 +695,11 @@ fn request_route(world: &mut OSRMWorld, step: &Step, state: String) {
|
||||
},
|
||||
"times" => {
|
||||
// TODO: go over steps
|
||||
|
||||
let (_, response) = route_result.as_ref().expect("osrm-routed returned an unexpected error");
|
||||
let actual_times : Vec<f64>= response.routes.first().expect("no route returned").legs.iter().map(|leg| {
|
||||
leg.steps.iter().filter(|step| step.duration > 0.).map(|step| step.duration).collect::<Vec<f64>>()
|
||||
}).flatten().collect();
|
||||
let (expected_times, offset) = extract_number_vector_and_offset("s", expectation);
|
||||
// println!("{actual_times:?} == {expected_times:?} +- {offset}");
|
||||
assert_eq!(actual_times.len(), expected_times.len(), "times mismatch: {actual_times:?} != {expected_times:?} +- {offset}");
|
||||
|
||||
zip(actual_times, expected_times).for_each(|(actual_time, expected_time)| {
|
||||
@ -684,6 +708,7 @@ fn request_route(world: &mut OSRMWorld, step: &Step, state: String) {
|
||||
});
|
||||
},
|
||||
"distances" => {
|
||||
let (_, response) = route_result.as_ref().expect("osrm-routed returned an unexpected error");
|
||||
let actual_distances = response.routes.first().expect("no route returned").legs.iter().map(|leg| {
|
||||
leg.steps.iter().filter(|step| step.distance > 0.).map(|step| step.distance).collect::<Vec<f64>>()
|
||||
}).flatten().collect::<Vec<f64>>();
|
||||
@ -696,6 +721,7 @@ fn request_route(world: &mut OSRMWorld, step: &Step, state: String) {
|
||||
});
|
||||
},
|
||||
"weight" => {
|
||||
let (_, response) = route_result.as_ref().expect("osrm-routed returned an unexpected error");
|
||||
let actual_weight = response.routes.first().expect("no route returned").weight;
|
||||
let (expected_weight, offset) = extract_number_and_offset("s", expectation);
|
||||
assert!(
|
||||
@ -708,6 +734,7 @@ fn request_route(world: &mut OSRMWorld, step: &Step, state: String) {
|
||||
);
|
||||
},
|
||||
"distance" => {
|
||||
let (_, response) = route_result.as_ref().expect("osrm-routed returned an unexpected error");
|
||||
let actual_distance = response.routes.first().expect("no route returned").distance;
|
||||
let (expected_distance, offset) = extract_number_and_offset("m", expectation);
|
||||
assert!(
|
||||
@ -720,12 +747,14 @@ fn request_route(world: &mut OSRMWorld, step: &Step, state: String) {
|
||||
);
|
||||
},
|
||||
"summary" => {
|
||||
let (_, response) = route_result.as_ref().expect("osrm-routed returned an unexpected error");
|
||||
let actual_summary = response.routes.first().expect("no route returned").legs.iter().map(|leg| {
|
||||
leg.summary.clone()
|
||||
}).collect::<Vec<String>>().join(",");
|
||||
assert_eq!(actual_summary,expectation, "summary mismatch");
|
||||
},
|
||||
"data_version" => {
|
||||
let (_, response) = route_result.as_ref().expect("osrm-routed returned an unexpected error");
|
||||
let expected_data_version = match test_case.get("data_version") {
|
||||
Some(s) if !s.is_empty() => Some(s),
|
||||
_ => None,
|
||||
@ -737,6 +766,7 @@ fn request_route(world: &mut OSRMWorld, step: &Step, state: String) {
|
||||
);
|
||||
},
|
||||
"waypoints_count" => {
|
||||
let (_, response) = route_result.as_ref().expect("osrm-routed returned an unexpected error");
|
||||
let expected_waypoint_count = match test_case.get("waypoints_count") {
|
||||
Some(s) if !s.is_empty() => s.parse::<usize>().expect("waypoint_count is a number"),
|
||||
_ => 0,
|
||||
@ -752,6 +782,7 @@ fn request_route(world: &mut OSRMWorld, step: &Step, state: String) {
|
||||
);
|
||||
},
|
||||
"geometry" => {
|
||||
let (_, response) = route_result.as_ref().expect("osrm-routed returned an unexpected error");
|
||||
let expected_geometry = test_case.get("geometry").expect("no geometry found");
|
||||
match &response.routes.first().expect("no route").geometry {
|
||||
route_response::Geometry::A(actual_geometry) => {
|
||||
@ -763,10 +794,29 @@ fn request_route(world: &mut OSRMWorld, step: &Step, state: String) {
|
||||
},
|
||||
route_response::Geometry::B { coordinates: _, r#type: _ } => unimplemented!("geojson comparison"),
|
||||
}
|
||||
},
|
||||
"status" => {
|
||||
let actual_status = match route_result {
|
||||
Ok((code, _)) => code,
|
||||
Err((code, _)) => code,
|
||||
};
|
||||
|
||||
let expected_status = test_case.get("status").expect("no status found").parse::<u16>().expect("status code must be an u16 number");
|
||||
assert_eq!(
|
||||
expected_status,
|
||||
actual_status,
|
||||
"status does not match for test case {test_case:?}"
|
||||
);
|
||||
}
|
||||
"message" => {
|
||||
let actual_message = match route_result.as_ref() {
|
||||
Ok(_) => "".to_string(),
|
||||
Err((_status, e)) => e.message.clone(),
|
||||
};
|
||||
let expected_message = test_case.get("message").expect("no message found");
|
||||
assert_eq!(&actual_message, expected_message, "message does not match {test_case:?}");
|
||||
|
||||
},
|
||||
// "classes" => {},
|
||||
// TODO: more checks need to be implemented
|
||||
_ => {
|
||||
let msg = format!("case {case} = {expectation} not implemented");
|
||||
@ -793,7 +843,9 @@ fn main() {
|
||||
future::ready(()).boxed()
|
||||
})
|
||||
// .with_writer(DotWriter::default().normalized())
|
||||
// .filter_run("features/testbot/geometry.feature", |_, _, sc| {
|
||||
.filter_run("features", |_, _, sc| !sc.tags.iter().any(|t| t == "todo")),
|
||||
// .filter_run("features", |_, _, sc| {
|
||||
.filter_run("features/testbot/oneway_phantom.feature", |_, _, sc| {
|
||||
!sc.tags.iter().any(|t| t == "todo")
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user