use indexmap to keep order
This commit is contained in:
parent
444f6333b5
commit
f3503df2ec
11
Cargo.lock
generated
11
Cargo.lock
generated
@ -84,6 +84,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
name = "cggitem_sets"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"indexmap 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -282,6 +283,14 @@ dependencies = [
|
||||
"unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iovec"
|
||||
version = "0.1.2"
|
||||
@ -751,6 +760,7 @@ version = "1.0.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"indexmap 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@ -1235,6 +1245,7 @@ dependencies = [
|
||||
"checksum hyper 0.11.27 (registry+https://github.com/rust-lang/crates.io-index)" = "34a590ca09d341e94cddf8e5af0bbccde205d5fbc2fa3c09dd67c7f85cea59d7"
|
||||
"checksum hyper-tls 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a5aa51f6ae9842239b0fac14af5f22123b8432b4cc774a44ff059fcba0f675ca"
|
||||
"checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d"
|
||||
"checksum indexmap 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08173ba1e906efb6538785a8844dd496f5d34f0a2d88038e95195172fc667220"
|
||||
"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08"
|
||||
"checksum itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c069bbec61e1ca5a596166e55dfe4773ff745c3d16b700013bcaff9a6df2c682"
|
||||
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||
|
@ -8,9 +8,10 @@ log = "0.4"
|
||||
simple_logger = "0.5"
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
serde_json = "1.0"
|
||||
serde_json = { version = "1.0", features = ["preserve_order"] }
|
||||
reqwest = "0.8"
|
||||
select = { git = "https://github.com/utkarshkukreti/select.rs" }
|
||||
regex = "1.0"
|
||||
lazy_static = "1.0"
|
||||
winreg = "0.5"
|
||||
winreg = "0.5"
|
||||
indexmap = { version = "1.0", features = ["serde-1"] }
|
||||
|
@ -11,14 +11,15 @@ extern crate select;
|
||||
extern crate simple_logger;
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
extern crate indexmap;
|
||||
extern crate winreg;
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use regex::Regex;
|
||||
use reqwest::header::{Headers, UserAgent};
|
||||
use select::document::Document;
|
||||
use select::predicate::{Class, Name};
|
||||
use serde_json::Value;
|
||||
use std::collections::BTreeMap;
|
||||
use std::path::PathBuf;
|
||||
use std::{fs, io, thread, time};
|
||||
use time::Duration;
|
||||
@ -31,7 +32,7 @@ struct Realm {
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Champion {
|
||||
data: BTreeMap<String, ChampInfo>,
|
||||
data: IndexMap<String, ChampInfo>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@ -132,7 +133,7 @@ fn main() {
|
||||
|
||||
fn get_champs_with_positions_and_patch(
|
||||
client: &reqwest::Client,
|
||||
) -> (BTreeMap<String, Vec<String>>, String) {
|
||||
) -> (IndexMap<String, Vec<String>>, String) {
|
||||
let page = client
|
||||
.get("https://champion.gg")
|
||||
.send()
|
||||
@ -150,7 +151,7 @@ fn get_champs_with_positions_and_patch(
|
||||
.unwrap()
|
||||
.text();
|
||||
|
||||
let mut champions = BTreeMap::new();
|
||||
let mut champions = IndexMap::new();
|
||||
for node in document.find(Class("champ-height")) {
|
||||
let id = node.find(Class("home-champion"))
|
||||
.next()
|
||||
|
Loading…
Reference in New Issue
Block a user