~zenomat/encountrs

b83651622f47337a8018dc46055db7e4f583ff0e — zenomat 1 year, 5 months ago master
initial push
6 files changed, 1646 insertions(+), 0 deletions(-)

A .gitignore
A Cargo.lock
A Cargo.toml
A party
A src/main.rs
A struct
A  => .gitignore +1 -0
@@ 1,1 @@
/target

A  => Cargo.lock +1006 -0
@@ 1,1006 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3

[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"

[[package]]
name = "base64"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"

[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"

[[package]]
name = "bumpalo"
version = "3.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899"

[[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 = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"

[[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 = "encoding_rs"
version = "0.8.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7896dc8abb250ffdda33912550faa54c88ec8b998dec0b2c55ab224921ce11df"
dependencies = [
 "cfg-if",
]

[[package]]
name = "encountrs"
version = "0.1.0"
dependencies = [
 "num",
 "reqwest",
 "serde",
 "serde_json",
]

[[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 = "futures-channel"
version = "0.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010"
dependencies = [
 "futures-core",
]

[[package]]
name = "futures-core"
version = "0.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3"

[[package]]
name = "futures-io"
version = "0.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b"

[[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-core",
 "futures-io",
 "futures-task",
 "memchr",
 "pin-project-lite",
 "pin-utils",
 "slab",
]

[[package]]
name = "h2"
version = "0.3.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62eeb471aa3e3c9197aa4bfeabfe02982f6dc96f750486c0bb0009ac58b26d2b"
dependencies = [
 "bytes",
 "fnv",
 "futures-core",
 "futures-sink",
 "futures-util",
 "http",
 "indexmap",
 "slab",
 "tokio",
 "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.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31f4c6746584866f0feabcc69893c5b51beef3831656a968ed7ae254cdc4fd03"
dependencies = [
 "bytes",
 "fnv",
 "itoa",
]

[[package]]
name = "http-body"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6"
dependencies = [
 "bytes",
 "http",
 "pin-project-lite",
]

[[package]]
name = "httparse"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9100414882e15fb7feccb4897e5f0ff0ff1ca7d1a86a23208ada4d7a18e6c6c4"

[[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.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b26ae0a80afebe130861d90abf98e3814a4f28a4c6ffeb5ab8ebb2be311e0ef2"
dependencies = [
 "bytes",
 "futures-channel",
 "futures-core",
 "futures-util",
 "h2",
 "http",
 "http-body",
 "httparse",
 "httpdate",
 "itoa",
 "pin-project-lite",
 "socket2",
 "tokio",
 "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",
 "hyper",
 "native-tls",
 "tokio",
 "tokio-native-tls",
]

[[package]]
name = "idna"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8"
dependencies = [
 "matches",
 "unicode-bidi",
 "unicode-normalization",
]

[[package]]
name = "indexmap"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee"
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",
]

[[package]]
name = "ipnet"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35e70ee094dc02fd9c13fdad4940090f22dbd6ac7c9e7094a46cf0232a50bc7c"

[[package]]
name = "itoa"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"

[[package]]
name = "js-sys"
version = "0.3.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04"
dependencies = [
 "wasm-bindgen",
]

[[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.121"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f"

[[package]]
name = "log"
version = "0.4.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8"
dependencies = [
 "cfg-if",
]

[[package]]
name = "matches"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"

[[package]]
name = "memchr"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"

[[package]]
name = "mime"
version = "0.3.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"

[[package]]
name = "mio"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52da4364ffb0e4fe33a9841a98a3f3014fb964045ce4f7a45a398243c8d6b0c9"
dependencies = [
 "libc",
 "log",
 "miow",
 "ntapi",
 "wasi",
 "winapi",
]

[[package]]
name = "miow"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21"
dependencies = [
 "winapi",
]

[[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 = "ntapi"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f"
dependencies = [
 "winapi",
]

[[package]]
name = "num"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606"
dependencies = [
 "num-bigint",
 "num-complex",
 "num-integer",
 "num-iter",
 "num-rational",
 "num-traits",
]

[[package]]
name = "num-bigint"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f"
dependencies = [
 "autocfg",
 "num-integer",
 "num-traits",
]

[[package]]
name = "num-complex"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26873667bbbb7c5182d4a37c1add32cdf09f841af72da53318fdb81543c15085"
dependencies = [
 "num-traits",
]

[[package]]
name = "num-integer"
version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
dependencies = [
 "autocfg",
 "num-traits",
]

[[package]]
name = "num-iter"
version = "0.1.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59"
dependencies = [
 "autocfg",
 "num-integer",
 "num-traits",
]

[[package]]
name = "num-rational"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a"
dependencies = [
 "autocfg",
 "num-bigint",
 "num-integer",
 "num-traits",
]

[[package]]
name = "num-traits"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
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.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"

[[package]]
name = "openssl"
version = "0.10.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95"
dependencies = [
 "bitflags",
 "cfg-if",
 "foreign-types",
 "libc",
 "once_cell",
 "openssl-sys",
]

[[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.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb"
dependencies = [
 "autocfg",
 "cc",
 "libc",
 "pkg-config",
 "vcpkg",
]

[[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.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c"

[[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.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe"

[[package]]
name = "proc-macro2"
version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
dependencies = [
 "unicode-xid",
]

[[package]]
name = "quote"
version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58"
dependencies = [
 "proc-macro2",
]

[[package]]
name = "redox_syscall"
version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ae183fc1b06c149f0c1793e1eb447c8b04bfe46d48e9e48bfb8d2d7ed64ecf0"
dependencies = [
 "bitflags",
]

[[package]]
name = "remove_dir_all"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
dependencies = [
 "winapi",
]

[[package]]
name = "reqwest"
version = "0.11.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46a1f7aa4f35e5e8b4160449f51afc758f0ce6454315a9fa7d0d113e958c41eb"
dependencies = [
 "base64",
 "bytes",
 "encoding_rs",
 "futures-core",
 "futures-util",
 "h2",
 "http",
 "http-body",
 "hyper",
 "hyper-tls",
 "ipnet",
 "js-sys",
 "lazy_static",
 "log",
 "mime",
 "native-tls",
 "percent-encoding",
 "pin-project-lite",
 "serde",
 "serde_json",
 "serde_urlencoded",
 "tokio",
 "tokio-native-tls",
 "url",
 "wasm-bindgen",
 "wasm-bindgen-futures",
 "web-sys",
 "winreg",
]

[[package]]
name = "ryu"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"

[[package]]
name = "schannel"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75"
dependencies = [
 "lazy_static",
 "winapi",
]

[[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 = "serde"
version = "1.0.136"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"
dependencies = [
 "serde_derive",
]

[[package]]
name = "serde_derive"
version = "1.0.136"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9"
dependencies = [
 "proc-macro2",
 "quote",
 "syn",
]

[[package]]
name = "serde_json"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95"
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 = "slab"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5"

[[package]]
name = "socket2"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0"
dependencies = [
 "libc",
 "winapi",
]

[[package]]
name = "syn"
version = "1.0.90"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "704df27628939572cd88d33f171cd6f896f4eaca85252c6e0a72d8d8287ee86f"
dependencies = [
 "proc-macro2",
 "quote",
 "unicode-xid",
]

[[package]]
name = "tempfile"
version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
dependencies = [
 "cfg-if",
 "fastrand",
 "libc",
 "redox_syscall",
 "remove_dir_all",
 "winapi",
]

[[package]]
name = "tinyvec"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2"
dependencies = [
 "tinyvec_macros",
]

[[package]]
name = "tinyvec_macros"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"

[[package]]
name = "tokio"
version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee"
dependencies = [
 "bytes",
 "libc",
 "memchr",
 "mio",
 "num_cpus",
 "pin-project-lite",
 "socket2",
 "winapi",
]

[[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",
]

[[package]]
name = "tokio-util"
version = "0.6.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0"
dependencies = [
 "bytes",
 "futures-core",
 "futures-sink",
 "log",
 "pin-project-lite",
 "tokio",
]

[[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.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a1bdf54a7c28a2bbf701e1d2233f6c77f473486b94bee4f9678da5a148dca7f"
dependencies = [
 "cfg-if",
 "pin-project-lite",
 "tracing-core",
]

[[package]]
name = "tracing-core"
version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa31669fa42c09c34d94d8165dd2012e8ff3c66aca50f3bb226b68f216f2706c"
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-bidi"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f"

[[package]]
name = "unicode-normalization"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9"
dependencies = [
 "tinyvec",
]

[[package]]
name = "unicode-xid"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"

[[package]]
name = "url"
version = "2.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c"
dependencies = [
 "form_urlencoded",
 "idna",
 "matches",
 "percent-encoding",
]

[[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.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"

[[package]]
name = "wasm-bindgen"
version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06"
dependencies = [
 "cfg-if",
 "wasm-bindgen-macro",
]

[[package]]
name = "wasm-bindgen-backend"
version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca"
dependencies = [
 "bumpalo",
 "lazy_static",
 "log",
 "proc-macro2",
 "quote",
 "syn",
 "wasm-bindgen-shared",
]

[[package]]
name = "wasm-bindgen-futures"
version = "0.4.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2eb6ec270a31b1d3c7e266b999739109abce8b6c87e4b31fcfcd788b65267395"
dependencies = [
 "cfg-if",
 "js-sys",
 "wasm-bindgen",
 "web-sys",
]

[[package]]
name = "wasm-bindgen-macro"
version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01"
dependencies = [
 "quote",
 "wasm-bindgen-macro-support",
]

[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc"
dependencies = [
 "proc-macro2",
 "quote",
 "syn",
 "wasm-bindgen-backend",
 "wasm-bindgen-shared",
]

[[package]]
name = "wasm-bindgen-shared"
version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2"

[[package]]
name = "web-sys"
version = "0.3.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c060b319f29dd25724f09a2ba1418f142f539b2be99fbf4d2d5a8f7330afb8eb"
dependencies = [
 "js-sys",
 "wasm-bindgen",
]

[[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-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 = "winreg"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
dependencies = [
 "winapi",
]

A  => Cargo.toml +12 -0
@@ 1,12 @@
[package]
name = "encountrs"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
serde_json = "1.0.59"
serde = { version = "1.0.136", features = ["derive"] }
reqwest = { version = "0.11.10", features = ["blocking"] }
num = "0.4.0"

A  => party +4 -0
@@ 1,4 @@
level: 4
level: 5
level: 4
level: 6

A  => src/main.rs +453 -0
@@ 1,453 @@
#![allow(dead_code)]
use std::collections::BTreeMap;
use num::Integer;

use reqwest::blocking;
use serde::Deserialize;
use serde::Serialize;

enum Difficulty {
    Easy,
    Medium,
    Hard,
    Deadly,
}

struct XpTreshold {
    easy: Vec<i32>,
    medium: Vec<i32>,
    hard: Vec<i32>,
    deadly: Vec<i32>,
}

#[derive(Serialize, Deserialize, Debug)]
struct Options {
    choose: i32,
    kind: String,
    from: Vec<Ressource>,
}

#[derive(Serialize, Deserialize, Debug)]
struct DamageType {
    index: Option<String>,
    name: Option<String>,
    url: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
struct Damage {
    damage_type: Option<DamageType>,
    damage_dice: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
struct Attack {
    name: Option<String>,
    dc: Option<Dc>,
    damage: Option<Vec<Option<Damage>>>,
}

#[derive(Serialize, Deserialize, Debug)]
struct DcType {
    index: Option<String>,
    name: Option<String>,
    url: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
struct Dc {
    dc_type: Option<DcType>,
    dc_value: i32,
    success_type: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
struct LegendaryAction {
    name: Option<String>,
    desc: Option<String>,
    options: Option<Options>,
    attack_bonus: Option<i32>,
    dc: Option<Dc>,
    attacks: Option<Vec<Attack>>,
    damage: Option<Vec<Option<Damage>>>,
}

#[derive(Serialize, Deserialize, Debug)]
struct Ressource {
    index: Option<String>,
    name: Option<String>,
    url: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
struct Action {
    index: Option<String>,
    name: Option<String>,
    url: Option<String>,
    attack_bonus: Option<i32>,
    dc: Option<Dc>,
    attacks: Option<Vec<Attack>>,
    damage: Option<Vec<Damage>>,
}

#[derive(Serialize, Deserialize, Debug)]
struct ConditionImmunities {
    index: Option<String>,
    name: Option<String>,
    url: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
struct Proficency {
    index: Option<String>,
    name: Option<String>,
    url: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
struct Proficencies {
    value: i32,
    proficency: Vec<Proficencies>,
}

#[derive(Serialize, Deserialize, Debug)]
struct Reaction {
    name: Option<String>,
    desc: Option<String>,
    options: Option<Options>,
    attack_bonus: Option<i32>,
    dc: Option<Dc>,
    attacks: Option<Vec<Attack>>,
    damage: Option<Vec<Damage>>,
}

#[derive(Serialize, Deserialize, Debug)]
struct Senses {
    passive_perception: i32,
    blindsight: Option<String>,
    darkvision: Option<String>,
    tremorsense: Option<String>,
    truesight: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
struct Slot {
    x: i32, // NOTE(zeno): can use random key, I guess
}

#[derive(Serialize, Deserialize, Debug)]
enum UsageType {
    Will,
    PerDay,
    RechargeAfterRest,
    RechargeAfterRoll,
}

#[derive(Serialize, Deserialize, Debug)]
struct Usage {
    kind: UsageType,
    rest_types: Option<Vec<String>>,
    times: i32,
}

#[derive(Serialize, Deserialize, Debug)]
struct Spell {
    name: Option<String>,
    level: i32,
    url: Option<String>,
    usage: Usage,
}

#[derive(Serialize, Deserialize, Debug)]
struct SpellCasting {
    ability: Ressource,
    dc: i32,
    modifier: i32,
    components_required: Vec<String>,
    school: String,
    slots: Slot,
    spells: Vec<Spell>,
}

#[derive(Serialize, Deserialize, Debug)]
struct SpecialAbility {
    name: Option<String>,
    desc: String,
    attack_bonus: Option<i32>,
    damage: Option<Vec<Damage>>,
    dc: Option<Dc>,
    spellcasting: SpellCasting,
    usage: Usage,
}

#[derive(Serialize, Deserialize, Debug)]
struct Speed {
    walk: Option<String>,
    burrow: Option<String>,
    climb: Option<String>,
    fly: Option<String>,
    swim: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
enum Size {
    Tiny,
    Small,
    Medium,
    Large,
    Huge,
    Gargantuan,
}

#[derive(Serialize, Deserialize, Debug)]
struct Monster {
    index: Option<String>,
    name: Option<String>,
    url: Option<String>,
    desc: Option<Vec<String>>,
    charisma: i32,
    constitution: i32,
    dexterity: i32,
    intelligence: i32,
    strength: i32,
    wisdom: i32,
    size: Size,
    kind: String,
    subtype: Option<String>,
    alignment: Option<String>,
    armor_class: i32,
    hit_points: i32,
    hit_dice: String,
    actions: Vec<Action>,
    legendary_actions: Option<Vec<LegendaryAction>>,
    challenge_rating: f32,
    condition_immunities: Option<Vec<ConditionImmunities>>,
    damage_immunities: Option<Vec<String>>,
    damage_resistances: Option<Vec<String>>,
    damage_vulnerabilities: Option<Vec<String>>,
    forms: Option<Vec<Ressource>>,
    languages: String,
    proficencies: Option<Proficencies>,
    senses: Option<Senses>,
    speed: Option<Speed>,
    reactions: Option<Vec<Reaction>>,
    xp: i32,
}

#[derive(Serialize, Deserialize, Debug)]
struct CrResp {
    count: i32,
    results: Vec<Ressource>,
}

fn build_cr_url(cr: Vec<f32>) -> String {
    let mut url: String = String::new();
    url.push_str("?challenge_rating=");
    for c in cr {
        url.push_str(c.to_string().as_str());
    }
    return url;
}

fn get_monsters_by_cr(cr: Vec<f32>) -> CrResp {
    let url = String::from(format!(
        "https://www.dnd5eapi.co/api/monsters{}",
        build_cr_url(cr.clone())
    ));
    let body = match blocking::get(url) {
        Ok(resp) => resp
            .text()
            .unwrap()
            .replace("type", "kind")
            .replace("[]", "null"),
        Err(e) => panic!("ERROR: {}", e),
    };
    let res: CrResp = serde_json::from_str(&body).unwrap();
    return res;
}

fn get_monster_by_index(index: String) -> Monster {
    let url = String::from(format!("https://www.dnd5eapi.co/api/monsters/{}", index));
    let body = match blocking::get(url) {
        Ok(resp) => resp
            .text()
            .unwrap()
            .replace("type", "kind")
            .replace("[]", "null"),
        Err(e) => panic!("ERROR: {}", e),
    };
    let res: Monster = serde_json::from_str(&body).unwrap();
    return res;
}

fn get_xp_from_monster(monster: Monster) -> i32 {
    return monster.xp;
}

fn get_party_xp() -> Vec<i8> {
    use std::fs::File;
    use std::io::{BufRead, BufReader};

    let mut levels: Vec<i8> = Vec::new();
    let filename = "./party";
    // Open the file in read-only mode (ignoring errors).
    let file = File::open(filename).unwrap();
    let reader = BufReader::new(file);

    // Read the file line by line using the lines() iterator from std::io::BufRead.
    for (_index, line) in reader.lines().enumerate() {
        let line = line.unwrap(); // Ignore errors.
                                  // Show the line and its number.
        if line.starts_with("level: ") {
            levels.push(
                line.split_whitespace()
                    .nth(1)
                    .unwrap()
                    .parse::<i8>()
                    .unwrap(),
            );
        }
    }
    return levels;
}

fn get_treshold_xp(tresholds: XpTreshold, difficulty: Difficulty, playerlevel: Vec<i8>) -> i32 {
    let mut treshold: i32 = 0;
    match difficulty {
        Difficulty::Easy => {
            for level in playerlevel.iter() {
                println!(
                    "XpValue for level ({}): {}",
                    level,
                    tresholds.easy[usize::try_from(level - 1).unwrap()]
                );
                treshold += tresholds.easy[usize::try_from(level - 1).unwrap()];
            }
        }
        Difficulty::Medium => {
            for level in playerlevel.iter() {
                println!(
                    "XpValue for level ({}): {}",
                    level,
                    tresholds.medium[usize::try_from(level - 1).unwrap()]
                );
                treshold += tresholds.medium[usize::try_from(level - 1).unwrap()];
            }
        }
        Difficulty::Hard => {
            for level in playerlevel.iter() {
                println!(
                    "XpValue for level ({}): {}",
                    level,
                    tresholds.hard[usize::try_from(level - 1).unwrap()]
                );
                treshold += tresholds.hard[usize::try_from(level - 1).unwrap()];
            }
        }
        Difficulty::Deadly => {
            for level in playerlevel.iter() {
                println!(
                    "XpValue for level ({}): {}",
                    level,
                    tresholds.deadly[usize::try_from(level - 1).unwrap()]
                );
                treshold += tresholds.deadly[usize::try_from(level - 1).unwrap()];
            }
        }
    }
    return treshold;
}

fn get_digits<T>(num: T) -> Vec<u32> 
    where T: Integer,
          T: std::fmt::Display
 {
    let digits: Vec<_> = num.to_string().chars().map(|d| d.to_digit(10).unwrap()).collect();
    return digits;
}

// TODO(zeno): continue here
// figure out proper monster xp to cr mapping,
// especially regarding the multiplier when encountering multiple monsters
fn determine_cr(xp_per_monster: i32, xp_to_cr: BTreeMap<i32, f32>) {
    let mut local_cr: f32 = 0.0;
    for (xp, cr) in xp_to_cr.iter() {
        println!("xp: {}, cr: {}", xp, cr);
        if xp_per_monster > *xp {
            println!("xp_Per_monster bigger, passing to next");
            continue;
        }
        local_cr = *cr;
        break;
    };
    println!("CR: {}", local_cr);
}

fn main() {
    // NOTE(zeno): if a value starts with 999 the following didgits are the 10th, 100th and 1000th
    // of the cr, so 0.125, 0.25, 0.5
    // I did this, because appearantly you cant use floats in hashmaps
    let xp_to_cr = BTreeMap::<i32, f32>::from([
        (10, 0.0),
        (25, 0.125),
        (50, 0.25),
        (100, 0.5),
        (200, 1.0),
        (450, 2.0),
        (700, 3.0),
        (1100, 4.0),
        (1800, 5.0),
        (2300, 6.0),
        (2900, 7.0),
        (3900, 8.0),
        (5000, 9.0),
        (5900, 10.0),
        (7200, 11.0),
        (8400, 12.0),
        (10000, 13.0),
        (11500, 14.0),
        (13000, 15.0),
        (15000, 16.0),
        (18000, 17.0),
        (20000, 18.0),
        (22000, 19.0),
        (25000, 20.0),
        (33000, 21.0),
        (41000, 22.0),
        (50000, 23.0),
        (62000, 24.0),
        (75000, 25.0),
        (90000, 26.0),
        (105000, 27.0),
        (120000, 28.0),
        (135000, 29.0),
        (155000, 30.0),
    ]);

    let tresholds = XpTreshold {
        easy: vec![
            25, 50, 75, 125, 250, 300, 350, 450, 550, 600, 800, 1000, 1100, 1250, 1400, 1600, 2000,
            2100, 2400, 2800,
        ],
        medium: vec![
            50, 100, 150, 250, 500, 600, 750, 900, 1100, 1200, 1600, 2000, 2200, 2500, 2800, 3200,
            3900, 4200, 4900, 5700,
        ],
        hard: vec![
            75, 150, 225, 375, 750, 900, 1100, 1400, 1600, 1900, 2400, 3000, 3400, 3800, 4300,
            4800, 5900, 6300, 7300, 8500,
        ],
        deadly: vec![
            100, 200, 400, 500, 1100, 1400, 1700, 2100, 2400, 2800, 3600, 4500, 5100, 5700, 6400,
            7200, 8800, 9500, 10900, 12700,
        ],
    };
    let playerlevel: Vec<i8> = get_party_xp();
    let difficulty: Difficulty = Difficulty::Medium;
    let monster_num: i8 = 3;
    let xp_budget: i32 = get_treshold_xp(tresholds, difficulty, playerlevel);

    let xp_per_monster: i32 = xp_budget / i32::from(monster_num);
    determine_cr(xp_per_monster, xp_to_cr);
    println!("{}", xp_per_monster);
}

A  => struct +170 -0
@@ 1,170 @@
struct Options {
    choose: i32,
    typ: String,
    from: Vec<Ressources>
}

struct DamageType {
    common: Ressources
}

struct Damage {
    damage_type: DamageType,
    damage_dice: String,
}

struct Attacks {
    name: String,
    dc: Dc,
    damage: Damage
}

struct DcType {
    common: Ressources
}

struct Dc {
    dc_type: DcType,
    dc_value: i32,
    success_type: String,
}

struct LegendaryAction {
    name: String,
    desc: String,
    options: Options,
    attack_bonus: i32,
    dc: Dc,
    attacks: Vec<Attack>,
    damage: Damage,
}

struct Ressources {
    index: String,
    name: String,
    url: String,
}

struct Action {
    common: Ressources,
    attack_bonus: i32,
    dc: Dc,
    attacks: Vec<Attack>,
    damage: Vec<Damage>
}

struct ConditionImmunities {
    common: Ressources
}

struct Proficency {
    common: Ressources
}

struct Proficencies {
    value: i32,
    proficency: Vec<Proficencies>
}

struct Reaction {
    name: String,
    desc: String,
    options: Options,
    attack_bonus: i32,
    dc: Dc,
    attacks: Vec<Attack>,
    damage: Vec<Damage,
}

struct Senses {
    passive_perception: i32,
    blindsight: String,
    darkvision: String,
    tremorsense: String,
    truesight: String,
}

struct Slot {
    x: i32, // NOTE(zeno): can use random key, I guess
}

enum UsageType {
    will,
    per_day,
    recharge_after_rest,
    recharge_on_roll,
}

struct Usage {
    typ: UsageType,
    rest_types: Vec<String>,
    times: i32,
}

struct Spell {
    name: String,
    level: i32,
    url: String,
    usage: Usage,
}

struct SpellCasting {
    ability: Ressource,
    dc: i32,
    modifier: i32,
    components_required: Vec<String>,
    school: String,
    slots: Slot,
    spells: Vec<Spell>,
}

struct SpecialAbility {
    name: String,
    desk: String,
    attack_bonus: number,
    damage: Vec<Damage>,
    dc: Dc,
    spellcasting: SpellCasting,
    usage: Usage,
}

struct Speed {
    walk: String,
    burrow: String,
    climb: String,
    fly: String,
    swim: String,
}

struct Monster {
    index: String,
    name: String,
    url: String,
    desc: Vec<String>,
    charisma: i32,
    constitution: i32,
    dexterity: i32,
    intelligence: i32,
    strength: i32,
    wisdom: i32,
    size: usize,
    typ: String,
    subtype: String,
    alignments: Alignments,
    armor_class: i32,
    hit_points: i32,
    hit_dice: String,
    actions: Vec<Action>,
    legendary_actions: Vec<LegendaryAction>,
    challenge_rating: i32,
    condition_immunities: Vec<ConditionImmunities>,
    damage_immunities: Vec<String>,
    damage_resistances: Vec<String>,
    damage_vulnerabilities: Vec<String>,
    forms: Vec<Ressources>,
    languages: String,
    proficencies: Proficencies,
    senses: Senses,
    speed: Speed,
    xp: i32,
}