Migration to Rust 2018
All checks were successful
git.nyyu.dev/CGGItemSets/PR-1 This commit looks good

This commit is contained in:
Sl@ny 2019-09-26 22:39:25 +02:00
parent a5c25f9bbc
commit 4855eaaff1
6 changed files with 23 additions and 64 deletions

6
Cargo.lock generated
View File

@ -125,7 +125,7 @@ dependencies = [
"serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)",
"simple_logger 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"winreg 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winreg 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1475,7 +1475,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "winreg"
version = "0.6.0"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1659,5 +1659,5 @@ dependencies = [
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
"checksum winreg 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "daf67b95d0b1bf421c4f11048d63110ca3719977169eec86396b614c8942b6e0"
"checksum winreg 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9"
"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"

View File

@ -1,7 +1,8 @@
[package]
name = "cggitem_sets"
version = "0.1.0"
authors = ["nyyu <mail@nyyu.tk>"]
authors = ["nyyu <mail@nyyu.dev>"]
edition = "2018"
[dependencies]
log = "0.4"

View File

@ -1,21 +1,11 @@
extern crate indexmap;
extern crate lazy_static;
extern crate log;
extern crate regex;
extern crate reqwest;
extern crate select;
extern crate serde;
extern crate serde_json;
extern crate simple_logger;
extern crate winreg;
use indexmap::IndexMap;
use regex::Regex;
use select::document::Document;
use select::predicate::{Class, Name};
use serde_json::Value;
use lazy_static::{lazy_static};
use data_source::DataSource;
use crate::data_source::DataSource;
pub struct CGGDataSource;
impl DataSource for CGGDataSource {

View File

@ -1,18 +1,9 @@
extern crate indexmap;
extern crate lazy_static;
extern crate log;
extern crate regex;
extern crate reqwest;
extern crate select;
extern crate serde;
extern crate serde_json;
extern crate simple_logger;
extern crate winreg;
use indexmap::IndexMap;
use serde_json::Value;
use serde_json::{Value, json};
use std::fs;
use std::path::PathBuf;
use log::{info, error};
use serde_derive::{Serialize, Deserialize};
#[derive(Serialize, Deserialize)]
struct ItemSet {

View File

@ -1,33 +1,21 @@
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate log;
extern crate reqwest;
extern crate serde;
#[macro_use]
extern crate serde_json;
extern crate regex;
extern crate select;
extern crate simple_logger;
#[macro_use]
extern crate lazy_static;
extern crate indexmap;
extern crate winreg;
mod cgg_data_source;
mod data_source;
mod pb_data_source;
use cgg_data_source::CGGDataSource;
use data_source::DataSource;
use indexmap::IndexMap;
use pb_data_source::PBDataSource;
use reqwest::header;
use std::io::{Error, ErrorKind};
use std::path::PathBuf;
use std::{fs, thread, time};
use time::Duration;
use winreg::RegKey;
use simple_logger;
use log::{info, error};
use serde_derive::{Deserialize};
mod cgg_data_source;
mod data_source;
mod pb_data_source;
use cgg_data_source::CGGDataSource;
use pb_data_source::PBDataSource;
use data_source::DataSource;
#[derive(Deserialize)]
struct Realm {
@ -90,7 +78,7 @@ fn main() {
.unwrap();
info!("LoL numbers of champs: {}", champion.data.len());
let data_sources: [Box<DataSource>; 2] = [Box::new(PBDataSource), Box::new(CGGDataSource)];
let data_sources: [Box<dyn DataSource>; 2] = [Box::new(PBDataSource), Box::new(CGGDataSource)];
for data_source in data_sources.iter() {
let (champs, patch) = data_source.get_champs_with_positions_and_patch(&client);

View File

@ -1,18 +1,7 @@
extern crate indexmap;
extern crate lazy_static;
extern crate log;
extern crate regex;
extern crate reqwest;
extern crate select;
extern crate serde;
extern crate serde_json;
extern crate simple_logger;
extern crate winreg;
use indexmap::IndexMap;
use serde_json::Value;
use data_source::DataSource;
use crate::data_source::DataSource;
pub struct PBDataSource;
impl DataSource for PBDataSource {